summaryrefslogtreecommitdiff
path: root/deps/v8/src/execution/isolate-data.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/execution/isolate-data.h')
-rw-r--r--deps/v8/src/execution/isolate-data.h35
1 files changed, 25 insertions, 10 deletions
diff --git a/deps/v8/src/execution/isolate-data.h b/deps/v8/src/execution/isolate-data.h
index adeb7f54d3..6eb23db2a2 100644
--- a/deps/v8/src/execution/isolate-data.h
+++ b/deps/v8/src/execution/isolate-data.h
@@ -8,6 +8,7 @@
#include "src/builtins/builtins.h"
#include "src/codegen/constants-arch.h"
#include "src/codegen/external-reference-table.h"
+#include "src/execution/stack-guard.h"
#include "src/execution/thread-local-top.h"
#include "src/roots/roots.h"
#include "src/utils/utils.h"
@@ -27,7 +28,7 @@ class Isolate;
// register.
class IsolateData final {
public:
- IsolateData() = default;
+ explicit IsolateData(Isolate* isolate) : stack_guard_(isolate) {}
static constexpr intptr_t kIsolateRootBias = kRootRegisterBias;
@@ -81,6 +82,7 @@ class IsolateData final {
// The FP and PC that are saved right before TurboAssembler::CallCFunction.
Address* fast_c_call_caller_fp_address() { return &fast_c_call_caller_fp_; }
Address* fast_c_call_caller_pc_address() { return &fast_c_call_caller_pc_; }
+ StackGuard* stack_guard() { return &stack_guard_; }
uint8_t* stack_is_iterable_address() { return &stack_is_iterable_; }
Address fast_c_call_caller_fp() { return fast_c_call_caller_fp_; }
Address fast_c_call_caller_pc() { return fast_c_call_caller_pc_; }
@@ -109,20 +111,27 @@ class IsolateData final {
Address* builtins() { return builtins_; }
private:
-// Static layout definition.
+ // Static layout definition.
+ //
+ // Note: The location of fields within IsolateData is significant. The
+ // closer they are to the value of kRootRegister (i.e.: isolate_root()), the
+ // cheaper it is to access them. See also: https://crbug.com/993264.
+ // The recommend guideline is to put frequently-accessed fields close to the
+ // beginning of IsolateData.
#define FIELDS(V) \
V(kEmbedderDataOffset, Internals::kNumIsolateDataSlots* kSystemPointerSize) \
V(kExternalMemoryOffset, kInt64Size) \
V(kExternalMemoryLlimitOffset, kInt64Size) \
V(kExternalMemoryAtLastMarkCompactOffset, kInt64Size) \
+ V(kFastCCallCallerFPOffset, kSystemPointerSize) \
+ V(kFastCCallCallerPCOffset, kSystemPointerSize) \
+ V(kStackGuardOffset, StackGuard::kSizeInBytes) \
V(kRootsTableOffset, RootsTable::kEntriesCount* kSystemPointerSize) \
V(kExternalReferenceTableOffset, ExternalReferenceTable::kSizeInBytes) \
V(kThreadLocalTopOffset, ThreadLocalTop::kSizeInBytes) \
V(kBuiltinEntryTableOffset, Builtins::builtin_count* kSystemPointerSize) \
V(kBuiltinsTableOffset, Builtins::builtin_count* kSystemPointerSize) \
V(kVirtualCallTargetRegisterOffset, kSystemPointerSize) \
- V(kFastCCallCallerFPOffset, kSystemPointerSize) \
- V(kFastCCallCallerPCOffset, kSystemPointerSize) \
V(kStackIsIterableOffset, kUInt8Size) \
/* This padding aligns IsolateData size by 8 bytes. */ \
V(kPaddingOffset, \
@@ -150,6 +159,17 @@ class IsolateData final {
// Caches the amount of external memory registered at the last MC.
int64_t external_memory_at_last_mark_compact_ = 0;
+ // Stores the state of the caller for TurboAssembler::CallCFunction so that
+ // the sampling CPU profiler can iterate the stack during such calls. These
+ // are stored on IsolateData so that they can be stored to with only one move
+ // instruction in compiled code.
+ Address fast_c_call_caller_fp_ = kNullAddress;
+ Address fast_c_call_caller_pc_ = kNullAddress;
+
+ // Fields related to the system and JS stack. In particular, this contains the
+ // stack limit used by stack checks in generated code.
+ StackGuard stack_guard_;
+
RootsTable roots_;
ExternalReferenceTable external_reference_table_;
@@ -169,12 +189,6 @@ class IsolateData final {
// ia32 (otherwise the arguments adaptor call runs out of registers).
void* virtual_call_target_register_ = nullptr;
- // Stores the state of the caller for TurboAssembler::CallCFunction so that
- // the sampling CPU profiler can iterate the stack during such calls. These
- // are stored on IsolateData so that they can be stored to with only one move
- // instruction in compiled code.
- Address fast_c_call_caller_fp_ = kNullAddress;
- Address fast_c_call_caller_pc_ = kNullAddress;
// Whether the SafeStackFrameIterator can successfully iterate the current
// stack. Only valid values are 0 or 1.
uint8_t stack_is_iterable_ = 1;
@@ -225,6 +239,7 @@ void IsolateData::AssertPredictableLayout() {
kFastCCallCallerFPOffset);
STATIC_ASSERT(offsetof(IsolateData, fast_c_call_caller_pc_) ==
kFastCCallCallerPCOffset);
+ STATIC_ASSERT(offsetof(IsolateData, stack_guard_) == kStackGuardOffset);
STATIC_ASSERT(offsetof(IsolateData, stack_is_iterable_) ==
kStackIsIterableOffset);
STATIC_ASSERT(sizeof(IsolateData) == IsolateData::kSize);