Rename "global context" to "native context",

in anticipation of the upcoming lexical global scope.

Mostly automatised as:

for FILE in `egrep -ril "global[ _]?context" src test/cctest`
do
  echo $FILE
  sed "s/Global context/Native context/g" <$FILE >$FILE.0
  sed "s/global context/native context/g" <$FILE.0 >$FILE.1
  sed "s/global_context/native_context/g" <$FILE.1 >$FILE.2
  sed "s/GLOBAL_CONTEXT/NATIVE_CONTEXT/g" <$FILE.2 >$FILE.3
  sed "s/GlobalContext/NativeContext/g" <$FILE.3 >$FILE
  rm $FILE.[0-9]
done

R=mstarzinger@chromium.org
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10832342

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12325 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
rossberg@chromium.org 2012-08-17 09:03:08 +00:00
parent 1011ae225f
commit 42552808ab
82 changed files with 696 additions and 696 deletions

View File

@ -92,9 +92,9 @@ MaybeObject* Accessors::ArrayGetLength(Object* object, void*) {
Object* Accessors::FlattenNumber(Object* value) {
if (value->IsNumber() || !value->IsJSValue()) return value;
JSValue* wrapper = JSValue::cast(value);
ASSERT(Isolate::Current()->context()->global_context()->number_function()->
ASSERT(Isolate::Current()->context()->native_context()->number_function()->
has_initial_map());
Map* number_map = Isolate::Current()->context()->global_context()->
Map* number_map = Isolate::Current()->context()->native_context()->
number_function()->initial_map();
if (wrapper->map() == number_map) return wrapper->value();
return value;

View File

@ -768,8 +768,8 @@ void Context::SetData(v8::Handle<String> data) {
i::Isolate* isolate = env->GetIsolate();
if (IsDeadCheck(isolate, "v8::Context::SetData()")) return;
i::Handle<i::Object> raw_data = Utils::OpenHandle(*data);
ASSERT(env->IsGlobalContext());
if (env->IsGlobalContext()) {
ASSERT(env->IsNativeContext());
if (env->IsNativeContext()) {
env->set_data(*raw_data);
}
}
@ -782,8 +782,8 @@ v8::Local<v8::Value> Context::GetData() {
return v8::Local<Value>();
}
i::Object* raw_result = NULL;
ASSERT(env->IsGlobalContext());
if (env->IsGlobalContext()) {
ASSERT(env->IsNativeContext());
if (env->IsNativeContext()) {
raw_result = env->data();
} else {
return Local<Value>();
@ -1575,7 +1575,7 @@ Local<Script> Script::Compile(v8::Handle<String> source,
i::Handle<i::JSFunction> result =
isolate->factory()->NewFunctionFromSharedFunctionInfo(
function,
isolate->global_context());
isolate->native_context());
return Local<Script>(ToApi<Script>(result));
}
@ -1602,7 +1602,7 @@ Local<Value> Script::Run() {
i::Handle<i::SharedFunctionInfo>
function_info(i::SharedFunctionInfo::cast(*obj), isolate);
fun = isolate->factory()->NewFunctionFromSharedFunctionInfo(
function_info, isolate->global_context());
function_info, isolate->native_context());
} else {
fun = i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate);
}
@ -3270,7 +3270,7 @@ static i::Context* GetCreationContext(i::JSObject* object) {
} else {
function = i::JSFunction::cast(constructor);
}
return function->context()->global_context();
return function->context()->native_context();
}
@ -4484,7 +4484,7 @@ v8::Local<v8::Context> Context::GetCurrent() {
if (IsDeadCheck(isolate, "v8::Context::GetCurrent()")) {
return Local<Context>();
}
i::Handle<i::Object> current = isolate->global_context();
i::Handle<i::Object> current = isolate->native_context();
if (current.is_null()) return Local<Context>();
i::Handle<i::Context> context = i::Handle<i::Context>::cast(current);
return Utils::ToLocal(context);
@ -4497,7 +4497,7 @@ v8::Local<v8::Context> Context::GetCalling() {
return Local<Context>();
}
i::Handle<i::Object> calling =
isolate->GetCallingGlobalContext();
isolate->GetCallingNativeContext();
if (calling.is_null()) return Local<Context>();
i::Handle<i::Context> context = i::Handle<i::Context>::cast(calling);
return Utils::ToLocal(context);

View File

@ -75,12 +75,12 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm,
// Load the built-in InternalArray function from the current context.
static void GenerateLoadInternalArrayFunction(MacroAssembler* masm,
Register result) {
// Load the global context.
// Load the native context.
__ ldr(result, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ ldr(result,
FieldMemOperand(result, GlobalObject::kGlobalContextOffset));
// Load the InternalArray function from the global context.
FieldMemOperand(result, GlobalObject::kNativeContextOffset));
// Load the InternalArray function from the native context.
__ ldr(result,
MemOperand(result,
Context::SlotOffset(
@ -90,12 +90,12 @@ static void GenerateLoadInternalArrayFunction(MacroAssembler* masm,
// Load the built-in Array function from the current context.
static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) {
// Load the global context.
// Load the native context.
__ ldr(result, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ ldr(result,
FieldMemOperand(result, GlobalObject::kGlobalContextOffset));
// Load the Array function from the global context.
FieldMemOperand(result, GlobalObject::kNativeContextOffset));
// Load the Array function from the native context.
__ ldr(result,
MemOperand(result,
Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX)));
@ -1405,7 +1405,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
const int kGlobalIndex =
Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
__ ldr(r2, FieldMemOperand(cp, kGlobalIndex));
__ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset));
__ ldr(r2, FieldMemOperand(r2, GlobalObject::kNativeContextOffset));
__ ldr(r2, FieldMemOperand(r2, kGlobalIndex));
__ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset));
@ -1600,7 +1600,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
const int kGlobalOffset =
Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
__ ldr(r0, FieldMemOperand(cp, kGlobalOffset));
__ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset));
__ ldr(r0, FieldMemOperand(r0, GlobalObject::kNativeContextOffset));
__ ldr(r0, FieldMemOperand(r0, kGlobalOffset));
__ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset));

View File

@ -106,10 +106,10 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
? Context::FUNCTION_MAP_INDEX
: Context::STRICT_MODE_FUNCTION_MAP_INDEX;
// Compute the function map in the current global context and set that
// Compute the function map in the current native context and set that
// as the map of the allocated object.
__ ldr(r2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset));
__ ldr(r2, FieldMemOperand(r2, GlobalObject::kNativeContextOffset));
__ ldr(r5, MemOperand(r2, Context::SlotOffset(map_index)));
__ str(r5, FieldMemOperand(r0, HeapObject::kMapOffset));
@ -149,8 +149,8 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
__ IncrementCounter(counters->fast_new_closure_try_optimized(), 1, r6, r7);
// r2 holds global context, r1 points to fixed array of 3-element entries
// (global context, optimized code, literals).
// r2 holds native context, r1 points to fixed array of 3-element entries
// (native context, optimized code, literals).
// The optimized code map must never be empty, so check the first elements.
Label install_optimized;
// Speculatively move code object into r4.
@ -290,9 +290,9 @@ void FastNewBlockContextStub::Generate(MacroAssembler* masm) {
__ mov(r2, Operand(Smi::FromInt(length)));
__ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset));
// If this block context is nested in the global context we get a smi
// If this block context is nested in the native context we get a smi
// sentinel instead of a function. The block context should get the
// canonical empty function of the global context as its closure which
// canonical empty function of the native context as its closure which
// we still have to look up.
Label after_sentinel;
__ JumpIfNotSmi(r3, &after_sentinel);
@ -302,7 +302,7 @@ void FastNewBlockContextStub::Generate(MacroAssembler* masm) {
__ Assert(eq, message);
}
__ ldr(r3, GlobalObjectOperand());
__ ldr(r3, FieldMemOperand(r3, GlobalObject::kGlobalContextOffset));
__ ldr(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset));
__ ldr(r3, ContextOperand(r3, Context::CLOSURE_INDEX));
__ bind(&after_sentinel);
@ -4514,7 +4514,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX);
__ ldr(r4, MemOperand(r8, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset));
__ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset));
__ cmp(r1, Operand::Zero());
__ ldr(r4, MemOperand(r4, kNormalOffset), eq);
__ ldr(r4, MemOperand(r4, kAliasedOffset), ne);
@ -4689,7 +4689,7 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
// Get the arguments boilerplate from the current (global) context.
__ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ ldr(r4, FieldMemOperand(r4, GlobalObject::kGlobalContextOffset));
__ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset));
__ ldr(r4, MemOperand(r4, Context::SlotOffset(
Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX)));
@ -5207,7 +5207,7 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) {
__ ldr(r2, ContextOperand(cp, Context::GLOBAL_INDEX));
__ add(r3, r0, Operand(JSRegExpResult::kSize));
__ mov(r4, Operand(factory->empty_fixed_array()));
__ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset));
__ ldr(r2, FieldMemOperand(r2, GlobalObject::kNativeContextOffset));
__ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset));
__ ldr(r2, ContextOperand(r2, Context::REGEXP_RESULT_MAP_INDEX));
__ str(r4, FieldMemOperand(r0, JSObject::kPropertiesOffset));

View File

@ -106,7 +106,7 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
// Iterate over all the functions which share the same code object
// and make them use unoptimized version.
Context* context = function->context()->global_context();
Context* context = function->context()->native_context();
Object* element = context->get(Context::OPTIMIZED_FUNCTIONS_LIST);
SharedFunctionInfo* shared = function->shared();
while (!element->IsUndefined()) {

View File

@ -1306,9 +1306,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
__ Move(next, current);
}
__ bind(&loop);
// Terminate at global context.
// Terminate at native context.
__ ldr(temp, FieldMemOperand(next, HeapObject::kMapOffset));
__ LoadRoot(ip, Heap::kGlobalContextMapRootIndex);
__ LoadRoot(ip, Heap::kNativeContextMapRootIndex);
__ cmp(temp, ip);
__ b(eq, &fast);
// Check that extension is NULL.
@ -2759,7 +2759,7 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
__ JumpIfSmi(r2, if_false);
__ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset));
__ ldr(r3, ContextOperand(cp, Context::GLOBAL_INDEX));
__ ldr(r3, FieldMemOperand(r3, GlobalObject::kGlobalContextOffset));
__ ldr(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset));
__ ldr(r3, ContextOperand(r3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
__ cmp(r2, r3);
__ b(ne, if_false);
@ -3039,7 +3039,7 @@ void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) {
if (CpuFeatures::IsSupported(VFP2)) {
__ PrepareCallCFunction(1, r0);
__ ldr(r0, ContextOperand(context_register(), Context::GLOBAL_INDEX));
__ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset));
__ ldr(r0, FieldMemOperand(r0, GlobalObject::kNativeContextOffset));
__ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
CpuFeatures::Scope scope(VFP2);
@ -3061,7 +3061,7 @@ void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) {
__ PrepareCallCFunction(2, r0);
__ ldr(r1, ContextOperand(context_register(), Context::GLOBAL_INDEX));
__ mov(r0, Operand(r4));
__ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalContextOffset));
__ ldr(r1, FieldMemOperand(r1, GlobalObject::kNativeContextOffset));
__ CallCFunction(
ExternalReference::fill_heap_number_with_random_function(isolate()), 2);
}
@ -3459,7 +3459,7 @@ void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value();
Handle<FixedArray> jsfunction_result_caches(
isolate()->global_context()->jsfunction_result_caches());
isolate()->native_context()->jsfunction_result_caches());
if (jsfunction_result_caches->length() <= cache_id) {
__ Abort("Attempt to use undefined cache.");
__ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
@ -3472,7 +3472,7 @@ void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
Register key = r0;
Register cache = r1;
__ ldr(cache, ContextOperand(cp, Context::GLOBAL_INDEX));
__ ldr(cache, FieldMemOperand(cache, GlobalObject::kGlobalContextOffset));
__ ldr(cache, FieldMemOperand(cache, GlobalObject::kNativeContextOffset));
__ ldr(cache, ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX));
__ ldr(cache,
FieldMemOperand(cache, FixedArray::OffsetOfElementAt(cache_id)));
@ -4450,7 +4450,7 @@ void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
Scope* declaration_scope = scope()->DeclarationScope();
if (declaration_scope->is_global_scope() ||
declaration_scope->is_module_scope()) {
// Contexts nested in the global context have a canonical empty function
// Contexts nested in the native context have a canonical empty function
// as their closure, not the anonymous closure containing the global
// code. Pass a smi sentinel and let the runtime look up the empty
// function.

View File

@ -3596,11 +3596,11 @@ void LCodeGen::DoRandom(LRandom* instr) {
static const int kSeedSize = sizeof(uint32_t);
STATIC_ASSERT(kPointerSize == kSeedSize);
__ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset));
__ ldr(r0, FieldMemOperand(r0, GlobalObject::kNativeContextOffset));
static const int kRandomSeedOffset =
FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize;
__ ldr(r2, FieldMemOperand(r0, kRandomSeedOffset));
// r2: FixedArray of the global context's random seeds
// r2: FixedArray of the native context's random seeds
// Load state[0].
__ ldr(r1, FieldMemOperand(r2, ByteArray::kHeaderSize));

View File

@ -1351,22 +1351,22 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
Check(ne, "we should not have an empty lexical context");
#endif
// Load the global context of the current context.
// Load the native context of the current context.
int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
ldr(scratch, FieldMemOperand(scratch, offset));
ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset));
ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset));
// Check the context is a global context.
// Check the context is a native context.
if (emit_debug_code()) {
// TODO(119): avoid push(holder_reg)/pop(holder_reg)
// Cannot use ip as a temporary in this verification code. Due to the fact
// that ip is clobbered as part of cmp with an object Operand.
push(holder_reg); // Temporarily save holder on the stack.
// Read the first word and compare to the global_context_map.
// Read the first word and compare to the native_context_map.
ldr(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset));
LoadRoot(ip, Heap::kGlobalContextMapRootIndex);
LoadRoot(ip, Heap::kNativeContextMapRootIndex);
cmp(holder_reg, ip);
Check(eq, "JSGlobalObject::global_context should be a global context.");
Check(eq, "JSGlobalObject::native_context should be a native context.");
pop(holder_reg); // Restore holder.
}
@ -1375,7 +1375,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
cmp(scratch, Operand(ip));
b(eq, &same_contexts);
// Check the context is a global context.
// Check the context is a native context.
if (emit_debug_code()) {
// TODO(119): avoid push(holder_reg)/pop(holder_reg)
// Cannot use ip as a temporary in this verification code. Due to the fact
@ -1387,9 +1387,9 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
Check(ne, "JSGlobalProxy::context() should not be null.");
ldr(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset));
LoadRoot(ip, Heap::kGlobalContextMapRootIndex);
LoadRoot(ip, Heap::kNativeContextMapRootIndex);
cmp(holder_reg, ip);
Check(eq, "JSGlobalObject::global_context should be a global context.");
Check(eq, "JSGlobalObject::native_context should be a native context.");
// Restore ip is not needed. ip is reloaded below.
pop(holder_reg); // Restore holder.
// Restore ip to holder's context.
@ -2883,7 +2883,7 @@ void MacroAssembler::LoadTransitionedArrayMapConditional(
Label* no_map_match) {
// Load the global or builtins object from the current context.
ldr(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset));
ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset));
// Check that the function's map is the same as the expected cached map.
ldr(scratch,
@ -2930,10 +2930,10 @@ void MacroAssembler::LoadInitialArrayMap(
void MacroAssembler::LoadGlobalFunction(int index, Register function) {
// Load the global or builtins object from the current context.
ldr(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
// Load the global context from the global or builtins object.
// Load the native context from the global or builtins object.
ldr(function, FieldMemOperand(function,
GlobalObject::kGlobalContextOffset));
// Load the function from the global context.
GlobalObject::kNativeContextOffset));
// Load the function from the native context.
ldr(function, MemOperand(function, Context::SlotOffset(index)));
}

View File

@ -500,8 +500,8 @@ class MacroAssembler: public Assembler {
void LoadContext(Register dst, int context_chain_length);
// Conditionally load the cached Array transitioned map of type
// transitioned_kind from the global context if the map in register
// map_in_out is the cached Array map in the global context of
// transitioned_kind from the native context if the map in register
// map_in_out is the cached Array map in the native context of
// expected_kind.
void LoadTransitionedArrayMapConditional(
ElementsKind expected_kind,

View File

@ -284,10 +284,10 @@ void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm,
Register prototype) {
// Load the global or builtins object from the current context.
__ ldr(prototype, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
// Load the global context from the global or builtins object.
// Load the native context from the global or builtins object.
__ ldr(prototype,
FieldMemOperand(prototype, GlobalObject::kGlobalContextOffset));
// Load the function from the global context.
FieldMemOperand(prototype, GlobalObject::kNativeContextOffset));
// Load the function from the native context.
__ ldr(prototype, MemOperand(prototype, Context::SlotOffset(index)));
// Load the initial map. The global functions all have initial maps.
__ ldr(prototype,
@ -310,7 +310,7 @@ void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
__ b(ne, miss);
// Get the global function with the given index.
Handle<JSFunction> function(
JSFunction::cast(isolate->global_context()->get(index)));
JSFunction::cast(isolate->native_context()->get(index)));
// Load its initial map. The global functions all have initial maps.
__ Move(prototype, Handle<Map>(function->initial_map()));
// Load the prototype from the initial map.

View File

@ -156,7 +156,7 @@ class Genesis BASE_EMBEDDED {
Heap* heap() const { return isolate_->heap(); }
private:
Handle<Context> global_context_;
Handle<Context> native_context_;
Isolate* isolate_;
// There may be more than one active genesis object: When GC is
@ -164,7 +164,7 @@ class Genesis BASE_EMBEDDED {
// processing callbacks which may create new environments.
Genesis* previous_;
Handle<Context> global_context() { return global_context_; }
Handle<Context> native_context() { return native_context_; }
// Creates some basic objects. Used for creating a context from scratch.
void CreateRoots();
@ -228,13 +228,13 @@ class Genesis BASE_EMBEDDED {
// Used both for deserialized and from-scratch contexts to add the extensions
// provided.
static bool InstallExtensions(Handle<Context> global_context,
static bool InstallExtensions(Handle<Context> native_context,
v8::ExtensionConfiguration* extensions);
static bool InstallExtension(const char* name,
ExtensionStates* extension_states);
static bool InstallExtension(v8::RegisteredExtension* current,
ExtensionStates* extension_states);
static void InstallSpecialObjects(Handle<Context> global_context);
static void InstallSpecialObjects(Handle<Context> native_context);
bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins);
bool ConfigureApiObject(Handle<JSObject> object,
Handle<ObjectTemplateInfo> object_template);
@ -444,20 +444,20 @@ Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) {
// writable.
Handle<Map> function_instance_map =
CreateFunctionMap(ADD_WRITEABLE_PROTOTYPE);
global_context()->set_function_instance_map(*function_instance_map);
native_context()->set_function_instance_map(*function_instance_map);
// Functions with this map will not have a 'prototype' property, and
// can not be used as constructors.
Handle<Map> function_without_prototype_map =
CreateFunctionMap(DONT_ADD_PROTOTYPE);
global_context()->set_function_without_prototype_map(
native_context()->set_function_without_prototype_map(
*function_without_prototype_map);
// Allocate the function map. This map is temporary, used only for processing
// of builtins.
// Later the map is replaced with writable prototype map, allocated below.
Handle<Map> function_map = CreateFunctionMap(ADD_READONLY_PROTOTYPE);
global_context()->set_function_map(*function_map);
native_context()->set_function_map(*function_map);
// The final map for functions. Writeable prototype.
// This map is installed in MakeFunctionInstancePrototypeWritable.
@ -477,14 +477,14 @@ Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) {
object_fun->set_initial_map(*object_function_map);
object_function_map->set_constructor(*object_fun);
global_context()->set_object_function(*object_fun);
native_context()->set_object_function(*object_fun);
// Allocate a new prototype for the object function.
Handle<JSObject> prototype = factory->NewJSObject(
isolate->object_function(),
TENURED);
global_context()->set_initial_object_prototype(*prototype);
native_context()->set_initial_object_prototype(*prototype);
SetPrototype(object_fun, prototype);
}
@ -509,16 +509,16 @@ Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) {
empty_function->shared()->DontAdaptArguments();
// Set prototypes for the function maps.
global_context()->function_map()->set_prototype(*empty_function);
global_context()->function_instance_map()->set_prototype(*empty_function);
global_context()->function_without_prototype_map()->
native_context()->function_map()->set_prototype(*empty_function);
native_context()->function_instance_map()->set_prototype(*empty_function);
native_context()->function_without_prototype_map()->
set_prototype(*empty_function);
function_instance_map_writable_prototype_->set_prototype(*empty_function);
// Allocate the function map first and then patch the prototype later
Handle<Map> empty_function_map = CreateFunctionMap(DONT_ADD_PROTOTYPE);
empty_function_map->set_prototype(
global_context()->object_function()->prototype());
native_context()->object_function()->prototype());
empty_function->set_map(*empty_function_map);
return empty_function;
}
@ -578,7 +578,7 @@ Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
Handle<Code> code(isolate()->builtins()->builtin(
Builtins::kStrictModePoisonPill));
throw_type_error_function->set_map(
global_context()->function_map());
native_context()->function_map());
throw_type_error_function->set_code(*code);
throw_type_error_function->shared()->set_code(*code);
throw_type_error_function->shared()->DontAdaptArguments();
@ -604,13 +604,13 @@ void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) {
// Allocate map for the strict mode function instances.
Handle<Map> strict_mode_function_instance_map =
CreateStrictModeFunctionMap(ADD_WRITEABLE_PROTOTYPE, empty);
global_context()->set_strict_mode_function_instance_map(
native_context()->set_strict_mode_function_instance_map(
*strict_mode_function_instance_map);
// Allocate map for the prototype-less strict mode instances.
Handle<Map> strict_mode_function_without_prototype_map =
CreateStrictModeFunctionMap(DONT_ADD_PROTOTYPE, empty);
global_context()->set_strict_mode_function_without_prototype_map(
native_context()->set_strict_mode_function_without_prototype_map(
*strict_mode_function_without_prototype_map);
// Allocate map for the strict mode functions. This map is temporary, used
@ -618,7 +618,7 @@ void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) {
// Later the map is replaced with writable prototype map, allocated below.
Handle<Map> strict_mode_function_map =
CreateStrictModeFunctionMap(ADD_READONLY_PROTOTYPE, empty);
global_context()->set_strict_mode_function_map(
native_context()->set_strict_mode_function_map(
*strict_mode_function_map);
// The final map for the strict mode functions. Writeable prototype.
@ -652,39 +652,39 @@ void Genesis::PoisonArgumentsAndCaller(Handle<Map> map) {
}
static void AddToWeakGlobalContextList(Context* context) {
ASSERT(context->IsGlobalContext());
static void AddToWeakNativeContextList(Context* context) {
ASSERT(context->IsNativeContext());
Heap* heap = context->GetIsolate()->heap();
#ifdef DEBUG
{ // NOLINT
ASSERT(context->get(Context::NEXT_CONTEXT_LINK)->IsUndefined());
// Check that context is not in the list yet.
for (Object* current = heap->global_contexts_list();
for (Object* current = heap->native_contexts_list();
!current->IsUndefined();
current = Context::cast(current)->get(Context::NEXT_CONTEXT_LINK)) {
ASSERT(current != context);
}
}
#endif
context->set(Context::NEXT_CONTEXT_LINK, heap->global_contexts_list());
heap->set_global_contexts_list(context);
context->set(Context::NEXT_CONTEXT_LINK, heap->native_contexts_list());
heap->set_native_contexts_list(context);
}
void Genesis::CreateRoots() {
// Allocate the global context FixedArray first and then patch the
// Allocate the native context FixedArray first and then patch the
// closure and extension object later (we need the empty function
// and the global object, but in order to create those, we need the
// global context).
global_context_ = Handle<Context>::cast(isolate()->global_handles()->Create(
*factory()->NewGlobalContext()));
AddToWeakGlobalContextList(*global_context_);
isolate()->set_context(*global_context());
// native context).
native_context_ = Handle<Context>::cast(isolate()->global_handles()->Create(
*factory()->NewNativeContext()));
AddToWeakNativeContextList(*native_context_);
isolate()->set_context(*native_context());
// Allocate the message listeners object.
{
v8::NeanderArray listeners;
global_context()->set_message_listeners(*listeners.value());
native_context()->set_message_listeners(*listeners.value());
}
}
@ -794,21 +794,21 @@ Handle<JSGlobalProxy> Genesis::CreateNewGlobals(
void Genesis::HookUpGlobalProxy(Handle<GlobalObject> inner_global,
Handle<JSGlobalProxy> global_proxy) {
// Set the global context for the global object.
inner_global->set_global_context(*global_context());
// Set the native context for the global object.
inner_global->set_native_context(*native_context());
inner_global->set_global_receiver(*global_proxy);
global_proxy->set_context(*global_context());
global_context()->set_global_proxy(*global_proxy);
global_proxy->set_context(*native_context());
native_context()->set_global_proxy(*global_proxy);
}
void Genesis::HookUpInnerGlobal(Handle<GlobalObject> inner_global) {
Handle<GlobalObject> inner_global_from_snapshot(
GlobalObject::cast(global_context_->extension()));
Handle<JSBuiltinsObject> builtins_global(global_context_->builtins());
global_context_->set_extension(*inner_global);
global_context_->set_global(*inner_global);
global_context_->set_security_token(*inner_global);
GlobalObject::cast(native_context_->extension()));
Handle<JSBuiltinsObject> builtins_global(native_context_->builtins());
native_context_->set_extension(*inner_global);
native_context_->set_global(*inner_global);
native_context_->set_security_token(*inner_global);
static const PropertyAttributes attributes =
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
ForceSetProperty(builtins_global,
@ -828,16 +828,16 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
Handle<JSFunction> empty_function) {
// --- G l o b a l C o n t e x t ---
// Use the empty function as closure (no scope info).
global_context()->set_closure(*empty_function);
global_context()->set_previous(NULL);
native_context()->set_closure(*empty_function);
native_context()->set_previous(NULL);
// Set extension and global object.
global_context()->set_extension(*inner_global);
global_context()->set_global(*inner_global);
native_context()->set_extension(*inner_global);
native_context()->set_global(*inner_global);
// Security setup: Set the security token of the global object to
// its the inner global. This makes the security check between two
// different contexts fail by default even in case of global
// object reinitialization.
global_context()->set_security_token(*inner_global);
native_context()->set_security_token(*inner_global);
Isolate* isolate = inner_global->GetIsolate();
Factory* factory = isolate->factory();
@ -849,7 +849,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
inner_global, object_name,
isolate->object_function(), DONT_ENUM));
Handle<JSObject> global = Handle<JSObject>(global_context()->global());
Handle<JSObject> global = Handle<JSObject>(native_context()->global());
// Install global Function object
InstallFunction(global, "Function", JS_FUNCTION_TYPE, JSFunction::kSize,
@ -886,7 +886,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
// search for the 'Array' property on the global object and use that one
// as the constructor. 'Array' property on a global object can be
// overwritten by JS code.
global_context()->set_array_function(*array_function);
native_context()->set_array_function(*array_function);
}
{ // --- N u m b e r ---
@ -894,7 +894,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
InstallFunction(global, "Number", JS_VALUE_TYPE, JSValue::kSize,
isolate->initial_object_prototype(),
Builtins::kIllegal, true);
global_context()->set_number_function(*number_fun);
native_context()->set_number_function(*number_fun);
}
{ // --- B o o l e a n ---
@ -902,7 +902,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
InstallFunction(global, "Boolean", JS_VALUE_TYPE, JSValue::kSize,
isolate->initial_object_prototype(),
Builtins::kIllegal, true);
global_context()->set_boolean_function(*boolean_fun);
native_context()->set_boolean_function(*boolean_fun);
}
{ // --- S t r i n g ---
@ -912,10 +912,10 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
Builtins::kIllegal, true);
string_fun->shared()->set_construct_stub(
isolate->builtins()->builtin(Builtins::kStringConstructCode));
global_context()->set_string_function(*string_fun);
native_context()->set_string_function(*string_fun);
Handle<Map> string_map =
Handle<Map>(global_context()->string_function()->initial_map());
Handle<Map>(native_context()->string_function()->initial_map());
Handle<DescriptorArray> string_descriptors(factory->NewDescriptorArray(1));
DescriptorArray::WhitenessWitness witness(*string_descriptors);
@ -938,7 +938,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
isolate->initial_object_prototype(),
Builtins::kIllegal, true);
global_context()->set_date_function(*date_fun);
native_context()->set_date_function(*date_fun);
}
@ -948,7 +948,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize,
isolate->initial_object_prototype(),
Builtins::kIllegal, true);
global_context()->set_regexp_function(*regexp_fun);
native_context()->set_regexp_function(*regexp_fun);
ASSERT(regexp_fun->has_initial_map());
Handle<Map> initial_map(regexp_fun->initial_map());
@ -1008,7 +1008,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
// RegExp prototype object is itself a RegExp.
Handle<Map> proto_map = factory->CopyMap(initial_map);
proto_map->set_prototype(global_context()->initial_object_prototype());
proto_map->set_prototype(native_context()->initial_object_prototype());
Handle<JSObject> proto = factory->NewJSObjectFromMap(proto_map);
proto->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex,
heap->query_colon_symbol());
@ -1032,7 +1032,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
Handle<JSFunction> cons = factory->NewFunction(name,
factory->the_hole_value());
{ MaybeObject* result = cons->SetInstancePrototype(
global_context()->initial_object_prototype());
native_context()->initial_object_prototype());
if (result->IsFailure()) return false;
}
cons->SetInstanceClassName(*name);
@ -1041,7 +1041,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
CHECK_NOT_EMPTY_HANDLE(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
global, name, json_object, DONT_ENUM));
global_context()->set_json_object(*json_object);
native_context()->set_json_object(*json_object);
}
{ // --- arguments_boilerplate_
@ -1053,7 +1053,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
isolate->builtins()->builtin(Builtins::kIllegal));
Handle<JSObject> prototype =
Handle<JSObject>(
JSObject::cast(global_context()->object_function()->prototype()));
JSObject::cast(native_context()->object_function()->prototype()));
Handle<JSFunction> function =
factory->NewFunctionWithPrototype(symbol,
@ -1067,7 +1067,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
function->shared()->set_expected_nof_properties(2);
Handle<JSObject> result = factory->NewJSObject(function);
global_context()->set_arguments_boilerplate(*result);
native_context()->set_arguments_boilerplate(*result);
// Note: length must be added as the first property and
// callee must be added as the second property.
CHECK_NOT_EMPTY_HANDLE(isolate,
@ -1108,7 +1108,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
array = factory->NewFixedArray(0);
elements->set(1, *array);
Handle<Map> old_map(global_context()->arguments_boilerplate()->map());
Handle<Map> old_map(native_context()->arguments_boilerplate()->map());
Handle<Map> new_map = factory->CopyMap(old_map);
new_map->set_pre_allocated_property_fields(2);
Handle<JSObject> result = factory->NewJSObjectFromMap(new_map);
@ -1117,7 +1117,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS);
result->set_elements(*elements);
ASSERT(result->HasNonStrictArgumentsElements());
global_context()->set_aliased_arguments_boilerplate(*result);
native_context()->set_aliased_arguments_boilerplate(*result);
}
{ // --- strict mode arguments boilerplate
@ -1163,17 +1163,17 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
}
map->set_function_with_prototype(true);
map->set_prototype(global_context()->object_function()->prototype());
map->set_prototype(native_context()->object_function()->prototype());
map->set_pre_allocated_property_fields(1);
map->set_inobject_properties(1);
// Copy constructor from the non-strict arguments boilerplate.
map->set_constructor(
global_context()->arguments_boilerplate()->map()->constructor());
native_context()->arguments_boilerplate()->map()->constructor());
// Allocate the arguments boilerplate object.
Handle<JSObject> result = factory->NewJSObjectFromMap(map);
global_context()->set_strict_mode_arguments_boilerplate(*result);
native_context()->set_strict_mode_arguments_boilerplate(*result);
// Add length property only for strict mode boilerplate.
CHECK_NOT_EMPTY_HANDLE(isolate,
@ -1208,7 +1208,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
Handle<String> name = factory->LookupAsciiSymbol("context_extension");
context_extension_fun->shared()->set_instance_class_name(*name);
global_context()->set_context_extension_function(*context_extension_fun);
native_context()->set_context_extension_function(*context_extension_fun);
}
@ -1220,7 +1220,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
Handle<JSFunction> delegate =
factory->NewFunction(factory->empty_symbol(), JS_OBJECT_TYPE,
JSObject::kHeaderSize, code, true);
global_context()->set_call_as_function_delegate(*delegate);
native_context()->set_call_as_function_delegate(*delegate);
delegate->shared()->DontAdaptArguments();
}
@ -1232,21 +1232,21 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
Handle<JSFunction> delegate =
factory->NewFunction(factory->empty_symbol(), JS_OBJECT_TYPE,
JSObject::kHeaderSize, code, true);
global_context()->set_call_as_constructor_delegate(*delegate);
native_context()->set_call_as_constructor_delegate(*delegate);
delegate->shared()->DontAdaptArguments();
}
// Initialize the out of memory slot.
global_context()->set_out_of_memory(heap->false_value());
native_context()->set_out_of_memory(heap->false_value());
// Initialize the data slot.
global_context()->set_data(heap->undefined_value());
native_context()->set_data(heap->undefined_value());
{
// Initialize the random seed slot.
Handle<ByteArray> zeroed_byte_array(
factory->NewByteArray(kRandomStateSize));
global_context()->set_random_seed(*zeroed_byte_array);
native_context()->set_random_seed(*zeroed_byte_array);
memset(zeroed_byte_array->GetDataStartAddress(), 0, kRandomStateSize);
}
return true;
@ -1254,7 +1254,7 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
void Genesis::InitializeExperimentalGlobal() {
Handle<JSObject> global = Handle<JSObject>(global_context()->global());
Handle<JSObject> global = Handle<JSObject>(native_context()->global());
// TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no
// longer need to live behind a flag, so functions get added to the snapshot.
@ -1357,7 +1357,7 @@ bool Genesis::CompileScriptCached(Vector<const char> name,
// Set up the function context. Conceptually, we should clone the
// function before overwriting the context but since we're in a
// single-threaded environment it is not strictly necessary.
ASSERT(top_context->IsGlobalContext());
ASSERT(top_context->IsNativeContext());
Handle<Context> context =
Handle<Context>(use_runtime_context
? Handle<Context>(top_context->runtime_context())
@ -1381,9 +1381,9 @@ bool Genesis::CompileScriptCached(Vector<const char> name,
#define INSTALL_NATIVE(Type, name, var) \
Handle<String> var##_name = factory()->LookupAsciiSymbol(name); \
Object* var##_native = \
global_context()->builtins()->GetPropertyNoExceptionThrown( \
native_context()->builtins()->GetPropertyNoExceptionThrown( \
*var##_name); \
global_context()->set_##var(Type::cast(var##_native));
native_context()->set_##var(Type::cast(var##_native));
void Genesis::InstallNativeFunctions() {
@ -1423,7 +1423,7 @@ bool Genesis::InstallNatives() {
// Create a function for the builtins object. Allocate space for the
// JavaScript builtins, a reference to the builtins object
// (itself) and a reference to the global_context directly in the object.
// (itself) and a reference to the native_context directly in the object.
Handle<Code> code = Handle<Code>(
isolate()->builtins()->builtin(Builtins::kIllegal));
Handle<JSFunction> builtins_fun =
@ -1440,7 +1440,7 @@ bool Genesis::InstallNatives() {
Handle<JSBuiltinsObject> builtins =
Handle<JSBuiltinsObject>::cast(factory()->NewGlobalObject(builtins_fun));
builtins->set_builtins(*builtins);
builtins->set_global_context(*global_context());
builtins->set_native_context(*native_context());
builtins->set_global_receiver(*builtins);
// Set up the 'global' properties of the builtins object. The
@ -1450,26 +1450,26 @@ bool Genesis::InstallNatives() {
static const PropertyAttributes attributes =
static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
Handle<String> global_symbol = factory()->LookupAsciiSymbol("global");
Handle<Object> global_obj(global_context()->global());
Handle<Object> global_obj(native_context()->global());
CHECK_NOT_EMPTY_HANDLE(isolate(),
JSObject::SetLocalPropertyIgnoreAttributes(
builtins, global_symbol, global_obj, attributes));
// Set up the reference from the global object to the builtins object.
JSGlobalObject::cast(global_context()->global())->set_builtins(*builtins);
JSGlobalObject::cast(native_context()->global())->set_builtins(*builtins);
// Create a bridge function that has context in the global context.
// Create a bridge function that has context in the native context.
Handle<JSFunction> bridge =
factory()->NewFunction(factory()->empty_symbol(),
factory()->undefined_value());
ASSERT(bridge->context() == *isolate()->global_context());
ASSERT(bridge->context() == *isolate()->native_context());
// Allocate the builtins context.
Handle<Context> context =
factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, bridge);
context->set_global(*builtins); // override builtins global object
global_context()->set_runtime_context(*context);
native_context()->set_runtime_context(*context);
{ // -- S c r i p t
// Builtin functions for Script.
@ -1480,7 +1480,7 @@ bool Genesis::InstallNatives() {
Handle<JSObject> prototype =
factory()->NewJSObject(isolate()->object_function(), TENURED);
SetPrototype(script_fun, prototype);
global_context()->set_script_function(*script_fun);
native_context()->set_script_function(*script_fun);
Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
@ -1625,7 +1625,7 @@ bool Genesis::InstallNatives() {
Handle<JSObject> prototype =
factory()->NewJSObject(isolate()->object_function(), TENURED);
SetPrototype(opaque_reference_fun, prototype);
global_context()->set_opaque_reference_function(*opaque_reference_fun);
native_context()->set_opaque_reference_function(*opaque_reference_fun);
}
{ // --- I n t e r n a l A r r a y ---
@ -1678,7 +1678,7 @@ bool Genesis::InstallNatives() {
array_function->initial_map()->AppendDescriptor(&d, witness);
}
global_context()->set_internal_array_function(*array_function);
native_context()->set_internal_array_function(*array_function);
}
if (FLAG_disable_native_files) {
@ -1701,10 +1701,10 @@ bool Genesis::InstallNatives() {
// Store the map for the string prototype after the natives has been compiled
// and the String function has been set up.
Handle<JSFunction> string_function(global_context()->string_function());
Handle<JSFunction> string_function(native_context()->string_function());
ASSERT(JSObject::cast(
string_function->initial_map()->prototype())->HasFastProperties());
global_context()->set_string_function_prototype_map(
native_context()->set_string_function_prototype_map(
HeapObject::cast(string_function->initial_map()->prototype())->map());
// Install Function.prototype.call and apply.
@ -1748,7 +1748,7 @@ bool Genesis::InstallNatives() {
// RegExpResult initial map.
// Find global.Array.prototype to inherit from.
Handle<JSFunction> array_constructor(global_context()->array_function());
Handle<JSFunction> array_constructor(native_context()->array_function());
Handle<JSObject> array_prototype(
JSObject::cast(array_constructor->instance_prototype()));
@ -1768,7 +1768,7 @@ bool Genesis::InstallNatives() {
Map::SetDescriptors(initial_map, reresult_descriptors);
{
JSFunction* array_function = global_context()->array_function();
JSFunction* array_function = native_context()->array_function();
Handle<DescriptorArray> array_descriptors(
array_function->initial_map()->instance_descriptors());
String* length = heap()->length_symbol();
@ -1797,7 +1797,7 @@ bool Genesis::InstallNatives() {
initial_map->set_pre_allocated_property_fields(2);
initial_map->set_unused_property_fields(0);
global_context()->set_regexp_result_map(*initial_map);
native_context()->set_regexp_result_map(*initial_map);
}
#ifdef DEBUG
@ -1831,10 +1831,10 @@ bool Genesis::InstallExperimentalNatives() {
static Handle<JSObject> ResolveBuiltinIdHolder(
Handle<Context> global_context,
Handle<Context> native_context,
const char* holder_expr) {
Factory* factory = global_context->GetIsolate()->factory();
Handle<GlobalObject> global(global_context->global());
Factory* factory = native_context->GetIsolate()->factory();
Handle<GlobalObject> global(native_context->global());
const char* period_pos = strchr(holder_expr, '.');
if (period_pos == NULL) {
return Handle<JSObject>::cast(
@ -1865,7 +1865,7 @@ void Genesis::InstallBuiltinFunctionIds() {
#define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \
{ \
Handle<JSObject> holder = ResolveBuiltinIdHolder( \
global_context(), #holder_expr); \
native_context(), #holder_expr); \
BuiltinFunctionId id = k##name; \
InstallBuiltinFunctionId(holder, #fun_name, id); \
}
@ -1877,7 +1877,7 @@ void Genesis::InstallBuiltinFunctionIds() {
// Do not forget to update macros.py with named constant
// of cache id.
#define JSFUNCTION_RESULT_CACHE_LIST(F) \
F(16, global_context()->regexp_function())
F(16, native_context()->regexp_function())
static FixedArray* CreateCache(int size, Handle<JSFunction> factory_function) {
@ -1913,34 +1913,34 @@ void Genesis::InstallJSFunctionResultCaches() {
#undef F
global_context()->set_jsfunction_result_caches(*caches);
native_context()->set_jsfunction_result_caches(*caches);
}
void Genesis::InitializeNormalizedMapCaches() {
Handle<FixedArray> array(
FACTORY->NewFixedArray(NormalizedMapCache::kEntries, TENURED));
global_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array));
native_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array));
}
bool Bootstrapper::InstallExtensions(Handle<Context> global_context,
bool Bootstrapper::InstallExtensions(Handle<Context> native_context,
v8::ExtensionConfiguration* extensions) {
Isolate* isolate = global_context->GetIsolate();
Isolate* isolate = native_context->GetIsolate();
BootstrapperActive active;
SaveContext saved_context(isolate);
isolate->set_context(*global_context);
if (!Genesis::InstallExtensions(global_context, extensions)) return false;
Genesis::InstallSpecialObjects(global_context);
isolate->set_context(*native_context);
if (!Genesis::InstallExtensions(native_context, extensions)) return false;
Genesis::InstallSpecialObjects(native_context);
return true;
}
void Genesis::InstallSpecialObjects(Handle<Context> global_context) {
Isolate* isolate = global_context->GetIsolate();
void Genesis::InstallSpecialObjects(Handle<Context> native_context) {
Isolate* isolate = native_context->GetIsolate();
Factory* factory = isolate->factory();
HandleScope scope;
Handle<JSGlobalObject> global(JSGlobalObject::cast(global_context->global()));
Handle<JSGlobalObject> global(JSGlobalObject::cast(native_context->global()));
// Expose the natives in global if a name for it is specified.
if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) {
Handle<String> natives = factory->LookupAsciiSymbol(FLAG_expose_natives_as);
@ -1969,10 +1969,10 @@ void Genesis::InstallSpecialObjects(Handle<Context> global_context) {
// debugger but without tanking the whole context.
if (!debug->Load()) return;
// Set the security token for the debugger context to the same as
// the shell global context to allow calling between these (otherwise
// the shell native context to allow calling between these (otherwise
// exposing debug global object doesn't make much sense).
debug->debug_context()->set_security_token(
global_context->security_token());
native_context->security_token());
Handle<String> debug_string =
factory->LookupAsciiSymbol(FLAG_expose_debug_as);
@ -2011,7 +2011,7 @@ void Genesis::ExtensionStates::set_state(RegisteredExtension* extension,
reinterpret_cast<void*>(static_cast<intptr_t>(state));
}
bool Genesis::InstallExtensions(Handle<Context> global_context,
bool Genesis::InstallExtensions(Handle<Context> native_context,
v8::ExtensionConfiguration* extensions) {
// TODO(isolates): Extensions on multiple isolates may take a little more
// effort. (The external API reads 'ignore'-- does that mean
@ -2136,8 +2136,8 @@ bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
bool Genesis::ConfigureGlobalObjects(
v8::Handle<v8::ObjectTemplate> global_proxy_template) {
Handle<JSObject> global_proxy(
JSObject::cast(global_context()->global_proxy()));
Handle<JSObject> inner_global(JSObject::cast(global_context()->global()));
JSObject::cast(native_context()->global_proxy()));
Handle<JSObject> inner_global(JSObject::cast(native_context()->global()));
if (!global_proxy_template.IsEmpty()) {
// Configure the global proxy object.
@ -2297,9 +2297,9 @@ void Genesis::MakeFunctionInstancePrototypeWritable() {
ASSERT(!strict_mode_function_instance_map_writable_prototype_.is_null());
// Replace function instance maps to make prototype writable.
global_context()->set_function_map(
native_context()->set_function_map(
*function_instance_map_writable_prototype_);
global_context()->set_strict_mode_function_map(
native_context()->set_strict_mode_function_map(
*strict_mode_function_instance_map_writable_prototype_);
}
@ -2325,10 +2325,10 @@ Genesis::Genesis(Isolate* isolate,
Handle<Context> new_context = Snapshot::NewContextFromSnapshot();
if (!new_context.is_null()) {
global_context_ =
native_context_ =
Handle<Context>::cast(isolate->global_handles()->Create(*new_context));
AddToWeakGlobalContextList(*global_context_);
isolate->set_context(*global_context_);
AddToWeakNativeContextList(*native_context_);
isolate->set_context(*native_context_);
isolate->counters()->contexts_created_by_snapshot()->Increment();
Handle<GlobalObject> inner_global;
Handle<JSGlobalProxy> global_proxy =
@ -2364,7 +2364,7 @@ Genesis::Genesis(Isolate* isolate,
InitializeExperimentalGlobal();
if (!InstallExperimentalNatives()) return;
result_ = global_context_;
result_ = native_context_;
}

View File

@ -126,7 +126,7 @@ class Bootstrapper {
char* AllocateAutoDeletedArray(int bytes);
// Used for new context creation.
bool InstallExtensions(Handle<Context> global_context,
bool InstallExtensions(Handle<Context> native_context,
v8::ExtensionConfiguration* extensions);
SourceCodeCache* extensions_cache() { return &extensions_cache_; }

View File

@ -199,11 +199,11 @@ static MaybeObject* ArrayCodeGenericCommon(Arguments* args,
array->set_length(Smi::FromInt(0));
array->set_elements(heap->empty_fixed_array());
if (!FLAG_smi_only_arrays) {
Context* global_context = isolate->context()->global_context();
Context* native_context = isolate->context()->native_context();
if (array->GetElementsKind() == GetInitialFastElementsKind() &&
!global_context->js_array_maps()->IsUndefined()) {
!native_context->js_array_maps()->IsUndefined()) {
FixedArray* map_array =
FixedArray::cast(global_context->js_array_maps());
FixedArray::cast(native_context->js_array_maps());
array->set_map(Map::cast(map_array->
get(TERMINAL_FAST_ELEMENTS_KIND)));
}
@ -312,7 +312,7 @@ BUILTIN(InternalArrayCodeGeneric) {
return ArrayCodeGenericCommon(
&args,
isolate,
isolate->context()->global_context()->internal_array_function());
isolate->context()->native_context()->internal_array_function());
}
@ -320,7 +320,7 @@ BUILTIN(ArrayCodeGeneric) {
return ArrayCodeGenericCommon(
&args,
isolate,
isolate->context()->global_context()->array_function());
isolate->context()->native_context()->array_function());
}
@ -402,7 +402,7 @@ static FixedArray* LeftTrimFixedArray(Heap* heap,
static bool ArrayPrototypeHasNoElements(Heap* heap,
Context* global_context,
Context* native_context,
JSObject* array_proto) {
// This method depends on non writability of Object and Array prototype
// fields.
@ -411,7 +411,7 @@ static bool ArrayPrototypeHasNoElements(Heap* heap,
Object* proto = array_proto->GetPrototype();
if (proto == heap->null_value()) return false;
array_proto = JSObject::cast(proto);
if (array_proto != global_context->initial_object_prototype()) return false;
if (array_proto != native_context->initial_object_prototype()) return false;
if (array_proto->elements() != heap->empty_fixed_array()) return false;
return array_proto->GetPrototype()->IsNull();
}
@ -461,11 +461,11 @@ static inline MaybeObject* EnsureJSArrayWithWritableFastElements(
static inline bool IsJSArrayFastElementMovingAllowed(Heap* heap,
JSArray* receiver) {
if (!FLAG_clever_optimizations) return false;
Context* global_context = heap->isolate()->context()->global_context();
Context* native_context = heap->isolate()->context()->native_context();
JSObject* array_proto =
JSObject::cast(global_context->array_function()->prototype());
JSObject::cast(native_context->array_function()->prototype());
return receiver->GetPrototype() == array_proto &&
ArrayPrototypeHasNoElements(heap, global_context, array_proto);
ArrayPrototypeHasNoElements(heap, native_context, array_proto);
}
@ -476,7 +476,7 @@ MUST_USE_RESULT static MaybeObject* CallJsBuiltin(
HandleScope handleScope(isolate);
Handle<Object> js_builtin =
GetProperty(Handle<JSObject>(isolate->global_context()->builtins()),
GetProperty(Handle<JSObject>(isolate->native_context()->builtins()),
name);
Handle<JSFunction> function = Handle<JSFunction>::cast(js_builtin);
int argc = args.length() - 1;
@ -706,7 +706,7 @@ BUILTIN(ArraySlice) {
// Array.slice(arguments, ...) is quite a common idiom (notably more
// than 50% of invocations in Web apps). Treat it in C++ as well.
Map* arguments_map =
isolate->context()->global_context()->arguments_boilerplate()->map();
isolate->context()->native_context()->arguments_boilerplate()->map();
bool is_arguments_object_with_fast_elements =
receiver->IsJSObject()
@ -943,10 +943,10 @@ BUILTIN(ArraySplice) {
BUILTIN(ArrayConcat) {
Heap* heap = isolate->heap();
Context* global_context = isolate->context()->global_context();
Context* native_context = isolate->context()->native_context();
JSObject* array_proto =
JSObject::cast(global_context->array_function()->prototype());
if (!ArrayPrototypeHasNoElements(heap, global_context, array_proto)) {
JSObject::cast(native_context->array_function()->prototype());
if (!ArrayPrototypeHasNoElements(heap, native_context, array_proto)) {
return CallJsBuiltin(isolate, "ArrayConcat", args);
}

View File

@ -122,7 +122,7 @@ class CompilationCacheScript : public CompilationSubCache {
// Sub-cache for eval scripts. Two caches for eval are used. One for eval calls
// in global contexts and one for eval calls in other contexts. The cache
// in native contexts and one for eval calls in other contexts. The cache
// considers the following pieces of information when checking for matching
// entries:
// 1. The source string.

View File

@ -311,10 +311,10 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() {
PrintF("Compiling method %s using hydrogen\n", *name->ToCString());
HTracer::Instance()->TraceCompilation(info()->function());
}
Handle<Context> global_context(
info()->closure()->context()->global_context());
Handle<Context> native_context(
info()->closure()->context()->native_context());
oracle_ = new(info()->zone()) TypeFeedbackOracle(
code, global_context, info()->isolate(), info()->zone());
code, native_context, info()->isolate(), info()->zone());
graph_builder_ = new(info()->zone()) HGraphBuilder(info(), oracle_);
HPhase phase(HPhase::kTotal);
graph_ = graph_builder_->CreateGraph();
@ -419,9 +419,9 @@ static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) {
ZoneScope zone_scope(info->zone(), DELETE_ON_EXIT);
PostponeInterruptsScope postpone(isolate);
ASSERT(!isolate->global_context().is_null());
ASSERT(!isolate->native_context().is_null());
Handle<Script> script = info->script();
script->set_context_data((*isolate->global_context())->data());
script->set_context_data((*isolate->native_context())->data());
#ifdef ENABLE_DEBUGGER_SUPPORT
if (info->is_eval()) {
@ -736,9 +736,9 @@ static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) {
if (FLAG_cache_optimized_code && code->kind() == Code::OPTIMIZED_FUNCTION) {
Handle<SharedFunctionInfo> shared(function->shared());
Handle<FixedArray> literals(function->literals());
Handle<Context> global_context(function->context()->global_context());
Handle<Context> native_context(function->context()->native_context());
SharedFunctionInfo::AddToOptimizedCodeMap(
shared, global_context, code, literals);
shared, native_context, code, literals);
}
}
@ -748,8 +748,8 @@ static bool InstallCodeFromOptimizedCodeMap(CompilationInfo* info) {
Handle<SharedFunctionInfo> shared = info->shared_info();
Handle<JSFunction> function = info->closure();
ASSERT(!function.is_null());
Handle<Context> global_context(function->context()->global_context());
int index = shared->SearchOptimizedCodeMap(*global_context);
Handle<Context> native_context(function->context()->native_context());
int index = shared->SearchOptimizedCodeMap(*native_context);
if (index > 0) {
if (FLAG_trace_opt) {
PrintF("[found optimized code for: ");
@ -893,7 +893,7 @@ void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) {
ASSERT(info->shared_info()->scope_info() != ScopeInfo::Empty());
info->closure()->ReplaceCode(*code);
if (info->shared_info()->SearchOptimizedCodeMap(
info->closure()->context()->global_context()) == -1) {
info->closure()->context()->native_context()) == -1) {
InsertCodeIntoOptimizedCodeMap(*info);
}
} else {

View File

@ -36,7 +36,7 @@ namespace internal {
Context* Context::declaration_context() {
Context* current = this;
while (!current->IsFunctionContext() && !current->IsGlobalContext()) {
while (!current->IsFunctionContext() && !current->IsNativeContext()) {
current = current->previous();
ASSERT(current->closure() == closure());
}
@ -55,19 +55,19 @@ JSBuiltinsObject* Context::builtins() {
}
Context* Context::global_context() {
Context* Context::native_context() {
// Fast case: the global object for this context has been set. In
// that case, the global object has a direct pointer to the global
// context.
if (global()->IsGlobalObject()) {
return global()->global_context();
return global()->native_context();
}
// During bootstrapping, the global object might not be set and we
// have to search the context chain to find the global context.
// have to search the context chain to find the native context.
ASSERT(Isolate::Current()->bootstrapper()->IsActive());
Context* current = this;
while (!current->IsGlobalContext()) {
while (!current->IsNativeContext()) {
JSFunction* closure = JSFunction::cast(current->closure());
current = Context::cast(closure->context());
}
@ -76,11 +76,11 @@ Context* Context::global_context() {
JSObject* Context::global_proxy() {
return global_context()->global_proxy_object();
return native_context()->global_proxy_object();
}
void Context::set_global_proxy(JSObject* object) {
global_context()->set_global_proxy_object(object);
native_context()->set_global_proxy_object(object);
}
@ -106,12 +106,12 @@ Handle<Object> Context::Lookup(Handle<String> name,
do {
if (FLAG_trace_contexts) {
PrintF(" - looking in context %p", reinterpret_cast<void*>(*context));
if (context->IsGlobalContext()) PrintF(" (global context)");
if (context->IsNativeContext()) PrintF(" (native context)");
PrintF("\n");
}
// 1. Check global objects, subjects of with, and extension objects.
if (context->IsGlobalContext() ||
if (context->IsNativeContext() ||
context->IsWithContext() ||
(context->IsFunctionContext() && context->has_extension())) {
Handle<JSObject> object(JSObject::cast(context->extension()), isolate);
@ -226,7 +226,7 @@ Handle<Object> Context::Lookup(Handle<String> name,
}
// 3. Prepare to continue with the previous (next outermost) context.
if (context->IsGlobalContext()) {
if (context->IsNativeContext()) {
follow_context_chain = false;
} else {
context = Handle<Context>(context->previous(), isolate);
@ -241,7 +241,7 @@ Handle<Object> Context::Lookup(Handle<String> name,
void Context::AddOptimizedFunction(JSFunction* function) {
ASSERT(IsGlobalContext());
ASSERT(IsNativeContext());
#ifdef DEBUG
if (FLAG_enable_slow_asserts) {
Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
@ -253,9 +253,9 @@ void Context::AddOptimizedFunction(JSFunction* function) {
CHECK(function->next_function_link()->IsUndefined());
// Check that the context belongs to the weak global contexts list.
// Check that the context belongs to the weak native contexts list.
bool found = false;
Object* context = GetHeap()->global_contexts_list();
Object* context = GetHeap()->native_contexts_list();
while (!context->IsUndefined()) {
if (context == this) {
found = true;
@ -271,7 +271,7 @@ void Context::AddOptimizedFunction(JSFunction* function) {
void Context::RemoveOptimizedFunction(JSFunction* function) {
ASSERT(IsGlobalContext());
ASSERT(IsNativeContext());
Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
JSFunction* prev = NULL;
while (!element->IsUndefined()) {
@ -295,7 +295,7 @@ void Context::RemoveOptimizedFunction(JSFunction* function) {
Object* Context::OptimizedFunctionsListHead() {
ASSERT(IsGlobalContext());
ASSERT(IsNativeContext());
return get(OPTIMIZED_FUNCTIONS_LIST);
}
@ -313,7 +313,7 @@ bool Context::IsBootstrappingOrValidParentContext(
if (Isolate::Current()->bootstrapper()->IsActive()) return true;
if (!object->IsContext()) return false;
Context* context = Context::cast(object);
return context->IsGlobalContext() || context->IsModuleContext() ||
return context->IsNativeContext() || context->IsModuleContext() ||
!child->IsModuleContext();
}

View File

@ -96,7 +96,7 @@ enum BindingFlags {
// must always be allocated via Heap::AllocateContext() or
// Factory::NewContext.
#define GLOBAL_CONTEXT_FIELDS(V) \
#define NATIVE_CONTEXT_FIELDS(V) \
V(GLOBAL_PROXY_INDEX, JSObject, global_proxy_object) \
V(SECURITY_TOKEN_INDEX, Object, security_token) \
V(BOOLEAN_FUNCTION_INDEX, JSFunction, boolean_function) \
@ -200,8 +200,8 @@ enum BindingFlags {
// In addition, function contexts may have statically allocated context slots
// to store local variables/functions that are accessed from inner functions
// (via static context addresses) or through 'eval' (dynamic context lookups).
// Finally, the global context contains additional slots for fast access to
// global properties.
// Finally, the native context contains additional slots for fast access to
// native properties.
class Context: public FixedArray {
public:
@ -227,7 +227,7 @@ class Context: public FixedArray {
// This slot holds the thrown value in catch contexts.
THROWN_OBJECT_INDEX = MIN_CONTEXT_SLOTS,
// These slots are only in global contexts.
// These slots are only in native contexts.
GLOBAL_PROXY_INDEX = MIN_CONTEXT_SLOTS,
SECURITY_TOKEN_INDEX,
ARGUMENTS_BOILERPLATE_INDEX,
@ -294,7 +294,7 @@ class Context: public FixedArray {
NEXT_CONTEXT_LINK, // Weak.
// Total number of slots.
GLOBAL_CONTEXT_SLOTS,
NATIVE_CONTEXT_SLOTS,
FIRST_WEAK_SLOT = OPTIMIZED_FUNCTIONS_LIST
};
@ -335,11 +335,11 @@ class Context: public FixedArray {
// The builtins object.
JSBuiltinsObject* builtins();
// Compute the global context by traversing the context chain.
Context* global_context();
// Compute the native context by traversing the context chain.
Context* native_context();
// Predicates for context types. IsGlobalContext is defined on Object
// because we frequently have to know if arbitrary objects are global
// Predicates for context types. IsNativeContext is defined on Object
// because we frequently have to know if arbitrary objects are natives
// contexts.
bool IsFunctionContext() {
Map* map = this->map();
@ -362,29 +362,29 @@ class Context: public FixedArray {
return map == map->GetHeap()->module_context_map();
}
// Tells whether the global context is marked with out of memory.
// Tells whether the native context is marked with out of memory.
inline bool has_out_of_memory();
// Mark the global context with out of memory.
// Mark the native context with out of memory.
inline void mark_out_of_memory();
// A global context hold a list of all functions which have been optimized.
// A native context hold a list of all functions which have been optimized.
void AddOptimizedFunction(JSFunction* function);
void RemoveOptimizedFunction(JSFunction* function);
Object* OptimizedFunctionsListHead();
void ClearOptimizedFunctions();
#define GLOBAL_CONTEXT_FIELD_ACCESSORS(index, type, name) \
#define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \
void set_##name(type* value) { \
ASSERT(IsGlobalContext()); \
ASSERT(IsNativeContext()); \
set(index, value); \
} \
type* name() { \
ASSERT(IsGlobalContext()); \
ASSERT(IsNativeContext()); \
return type::cast(get(index)); \
}
GLOBAL_CONTEXT_FIELDS(GLOBAL_CONTEXT_FIELD_ACCESSORS)
#undef GLOBAL_CONTEXT_FIELD_ACCESSORS
NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSORS)
#undef NATIVE_CONTEXT_FIELD_ACCESSORS
// Lookup the slot called name, starting with the current context.
// There are three possibilities:
@ -414,7 +414,7 @@ class Context: public FixedArray {
return kHeaderSize + index * kPointerSize - kHeapObjectTag;
}
static const int kSize = kHeaderSize + GLOBAL_CONTEXT_SLOTS * kPointerSize;
static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize;
// GC support.
typedef FixedBodyDescriptor<

View File

@ -2078,7 +2078,7 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) {
// Global evaluate.
if (global) {
// Evaluate in the global context.
// Evaluate in the native context.
response.body = this.exec_state_.evaluateGlobal(
expression, Boolean(disable_break), additional_context_object);
return;

View File

@ -97,8 +97,8 @@ static v8::Handle<v8::Context> GetDebugEventContext(Isolate* isolate) {
// Isolate::context() may have been NULL when "script collected" event
// occured.
if (context.is_null()) return v8::Local<v8::Context>();
Handle<Context> global_context(context->global_context());
return v8::Utils::ToLocal(global_context);
Handle<Context> native_context(context->native_context());
return v8::Utils::ToLocal(native_context);
}
@ -762,7 +762,7 @@ bool Debug::CompileDebuggerScript(int index) {
}
// Execute the shared function in the debugger context.
Handle<Context> context = isolate->global_context();
Handle<Context> context = isolate->native_context();
bool caught_exception;
Handle<JSFunction> function =
factory->NewFunctionFromSharedFunctionInfo(function_info, context);

View File

@ -272,7 +272,7 @@ void Deoptimizer::VisitAllOptimizedFunctionsForContext(
ZoneScope zone_scope(isolate->runtime_zone(), DELETE_ON_EXIT);
AssertNoAllocation no_allocation;
ASSERT(context->IsGlobalContext());
ASSERT(context->IsNativeContext());
visitor->EnterContext(context);
@ -303,10 +303,10 @@ void Deoptimizer::VisitAllOptimizedFunctionsForGlobalObject(
Object* proto = object->GetPrototype();
ASSERT(proto->IsJSGlobalObject());
VisitAllOptimizedFunctionsForContext(
GlobalObject::cast(proto)->global_context(), visitor);
GlobalObject::cast(proto)->native_context(), visitor);
} else if (object->IsGlobalObject()) {
VisitAllOptimizedFunctionsForContext(
GlobalObject::cast(object)->global_context(), visitor);
GlobalObject::cast(object)->native_context(), visitor);
}
}
@ -315,8 +315,8 @@ void Deoptimizer::VisitAllOptimizedFunctions(
OptimizedFunctionVisitor* visitor) {
AssertNoAllocation no_allocation;
// Run through the list of all global contexts and deoptimize.
Object* context = Isolate::Current()->heap()->global_contexts_list();
// Run through the list of all native contexts and deoptimize.
Object* context = Isolate::Current()->heap()->native_contexts_list();
while (!context->IsUndefined()) {
// GC can happen when the context is not fully initialized,
// so the global field of the context can be undefined.

View File

@ -62,13 +62,13 @@ class OptimizedFunctionVisitor BASE_EMBEDDED {
virtual ~OptimizedFunctionVisitor() {}
// Function which is called before iteration of any optimized functions
// from given global context.
// from given native context.
virtual void EnterContext(Context* context) = 0;
virtual void VisitFunction(JSFunction* function) = 0;
// Function which is called after iteration of all optimized functions
// from given global context.
// from given native context.
virtual void LeaveContext(Context* context) = 0;
};

View File

@ -246,7 +246,7 @@ Handle<Object> Execution::GetFunctionDelegate(Handle<Object> object) {
if (fun->IsHeapObject() &&
HeapObject::cast(fun)->map()->has_instance_call_handler()) {
return Handle<JSFunction>(
isolate->global_context()->call_as_function_delegate());
isolate->native_context()->call_as_function_delegate());
}
return factory->undefined_value();
@ -270,7 +270,7 @@ Handle<Object> Execution::TryGetFunctionDelegate(Handle<Object> object,
if (fun->IsHeapObject() &&
HeapObject::cast(fun)->map()->has_instance_call_handler()) {
return Handle<JSFunction>(
isolate->global_context()->call_as_function_delegate());
isolate->native_context()->call_as_function_delegate());
}
// If the Object doesn't have an instance-call handler we should
@ -303,7 +303,7 @@ Handle<Object> Execution::GetConstructorDelegate(Handle<Object> object) {
if (fun->IsHeapObject() &&
HeapObject::cast(fun)->map()->has_instance_call_handler()) {
return Handle<JSFunction>(
isolate->global_context()->call_as_constructor_delegate());
isolate->native_context()->call_as_constructor_delegate());
}
return isolate->factory()->undefined_value();
@ -331,7 +331,7 @@ Handle<Object> Execution::TryGetConstructorDelegate(
if (fun->IsHeapObject() &&
HeapObject::cast(fun)->map()->has_instance_call_handler()) {
return Handle<JSFunction>(
isolate->global_context()->call_as_constructor_delegate());
isolate->native_context()->call_as_constructor_delegate());
}
// If the Object doesn't have an instance-call handler we should
@ -680,7 +680,7 @@ Handle<JSRegExp> Execution::NewJSRegExp(Handle<String> pattern,
Handle<String> flags,
bool* exc) {
Handle<JSFunction> function = Handle<JSFunction>(
pattern->GetIsolate()->global_context()->regexp_function());
pattern->GetIsolate()->native_context()->regexp_function());
Handle<Object> re_obj = RegExpImpl::CreateRegExpLiteral(
function, pattern, flags, exc);
if (*exc) return Handle<JSRegExp>();
@ -726,7 +726,7 @@ Handle<JSFunction> Execution::InstantiateFunction(
// Fast case: see if the function has already been instantiated
int serial_number = Smi::cast(data->serial_number())->value();
Object* elm =
isolate->global_context()->function_cache()->
isolate->native_context()->function_cache()->
GetElementNoExceptionThrown(serial_number);
if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm));
// The function has not yet been instantiated in this context; do it.

View File

@ -284,10 +284,10 @@ Handle<String> Factory::NewExternalStringFromTwoByte(
}
Handle<Context> Factory::NewGlobalContext() {
Handle<Context> Factory::NewNativeContext() {
CALL_HEAP_FUNCTION(
isolate(),
isolate()->heap()->AllocateGlobalContext(),
isolate()->heap()->AllocateNativeContext(),
Context);
}
@ -552,16 +552,16 @@ Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
result->set_context(*context);
int index = function_info->SearchOptimizedCodeMap(context->global_context());
int index = function_info->SearchOptimizedCodeMap(context->native_context());
if (!function_info->bound() && index < 0) {
int number_of_literals = function_info->num_literals();
Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure);
if (number_of_literals > 0) {
// Store the global context in the literals array prefix. This
// Store the native context in the literals array prefix. This
// context will be used when creating object, regexp and array
// literals in this function.
literals->set(JSFunction::kLiteralGlobalContextIndex,
context->global_context());
literals->set(JSFunction::kLiteralNativeContextIndex,
context->native_context());
}
result->set_literals(*literals);
}
@ -1110,7 +1110,7 @@ Handle<JSFunction> Factory::NewFunctionHelper(Handle<String> name,
Handle<JSFunction> Factory::NewFunction(Handle<String> name,
Handle<Object> prototype) {
Handle<JSFunction> fun = NewFunctionHelper(name, prototype);
fun->set_context(isolate()->context()->global_context());
fun->set_context(isolate()->context()->native_context());
return fun;
}
@ -1136,7 +1136,7 @@ Handle<JSFunction> Factory::NewFunctionWithoutPrototype(
LanguageMode language_mode) {
Handle<JSFunction> fun =
NewFunctionWithoutPrototypeHelper(name, language_mode);
fun->set_context(isolate()->context()->global_context());
fun->set_context(isolate()->context()->native_context());
return fun;
}
@ -1147,8 +1147,8 @@ Handle<Object> Factory::ToObject(Handle<Object> object) {
Handle<Object> Factory::ToObject(Handle<Object> object,
Handle<Context> global_context) {
CALL_HEAP_FUNCTION(isolate(), object->ToObject(*global_context), Object);
Handle<Context> native_context) {
CALL_HEAP_FUNCTION(isolate(), object->ToObject(*native_context), Object);
}
@ -1320,7 +1320,7 @@ Handle<MapCache> Factory::AddToMapCache(Handle<Context> context,
Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context,
Handle<FixedArray> keys) {
if (context->map_cache()->IsUndefined()) {
// Allocate the new map cache for the global context.
// Allocate the new map cache for the native context.
Handle<MapCache> new_cache = NewMapCache(24);
context->set_map_cache(*new_cache);
}

View File

@ -160,7 +160,7 @@ class Factory {
const ExternalTwoByteString::Resource* resource);
// Create a global (but otherwise uninitialized) context.
Handle<Context> NewGlobalContext();
Handle<Context> NewNativeContext();
// Create a module context.
Handle<Context> NewModuleContext(Handle<ScopeInfo> scope_info);
@ -331,7 +331,7 @@ class Factory {
Handle<Object> ToObject(Handle<Object> object);
Handle<Object> ToObject(Handle<Object> object,
Handle<Context> global_context);
Handle<Context> native_context);
// Interface for creating error objects.
@ -457,7 +457,7 @@ class Factory {
Handle<DebugInfo> NewDebugInfo(Handle<SharedFunctionInfo> shared);
#endif
// Return a map using the map cache in the global context.
// Return a map using the map cache in the native context.
// The key the an ordered set of property names.
Handle<Map> ObjectLiteralMapFromCache(Handle<Context> context,
Handle<FixedArray> keys);
@ -499,7 +499,7 @@ class Factory {
// Create a new map cache.
Handle<MapCache> NewMapCache(int at_least_space_for);
// Update the map cache in the global context with (keys, map)
// Update the map cache in the native context with (keys, map)
Handle<MapCache> AddToMapCache(Handle<Context> context,
Handle<FixedArray> keys,
Handle<Map> map);

View File

@ -561,8 +561,8 @@ DEFINE_bool(gc_verbose, false, "print stuff during garbage collection")
DEFINE_bool(heap_stats, false, "report heap statistics before and after GC")
DEFINE_bool(code_stats, false, "report code statistics after GC")
DEFINE_bool(verify_heap, false, "verify heap pointers before and after GC")
DEFINE_bool(verify_global_context_separation, false,
"verify that code holds on to at most one global context after GC")
DEFINE_bool(verify_native_context_separation, false,
"verify that code holds on to at most one native context after GC")
DEFINE_bool(print_handles, false, "report handles after GC")
DEFINE_bool(print_global_handles, false, "report global handles after GC")

View File

@ -604,7 +604,7 @@ Handle<FixedArray> GetKeysInFixedArrayFor(Handle<JSReceiver> object,
Isolate* isolate = object->GetIsolate();
Handle<FixedArray> content = isolate->factory()->empty_fixed_array();
Handle<JSObject> arguments_boilerplate = Handle<JSObject>(
isolate->context()->global_context()->arguments_boilerplate(),
isolate->context()->native_context()->arguments_boilerplate(),
isolate);
Handle<JSFunction> arguments_function = Handle<JSFunction>(
JSFunction::cast(arguments_boilerplate->map()->constructor()),

View File

@ -175,7 +175,7 @@ Heap::Heap()
}
memset(roots_, 0, sizeof(roots_[0]) * kRootListLength);
global_contexts_list_ = NULL;
native_contexts_list_ = NULL;
mark_compact_collector_.heap_ = this;
external_string_table_.heap_ = this;
// Put a dummy entry in the remembered pages so we can find the list the
@ -755,7 +755,7 @@ void Heap::EnsureFromSpaceIsCommitted() {
void Heap::ClearJSFunctionResultCaches() {
if (isolate_->bootstrapper()->IsActive()) return;
Object* context = global_contexts_list_;
Object* context = native_contexts_list_;
while (!context->IsUndefined()) {
// Get the caches for this context. GC can happen when the context
// is not fully initialized, so the caches can be undefined.
@ -782,7 +782,7 @@ void Heap::ClearNormalizedMapCaches() {
return;
}
Object* context = global_contexts_list_;
Object* context = native_contexts_list_;
while (!context->IsUndefined()) {
// GC can happen when the context is not fully initialized,
// so the cache can be undefined.
@ -1295,8 +1295,8 @@ void Heap::Scavenge() {
}
}
// Scavenge object reachable from the global contexts list directly.
scavenge_visitor.VisitPointer(BitCast<Object**>(&global_contexts_list_));
// Scavenge object reachable from the native contexts list directly.
scavenge_visitor.VisitPointer(BitCast<Object**>(&native_contexts_list_));
new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
isolate_->global_handles()->IdentifyNewSpaceWeakIndependentHandles(
@ -1456,7 +1456,7 @@ void Heap::ProcessWeakReferences(WeakObjectRetainer* retainer) {
Object* undefined = undefined_value();
Object* head = undefined;
Context* tail = NULL;
Object* candidate = global_contexts_list_;
Object* candidate = native_contexts_list_;
// We don't record weak slots during marking or scavenges.
// Instead we do it once when we complete mark-compact cycle.
@ -1529,7 +1529,7 @@ void Heap::ProcessWeakReferences(WeakObjectRetainer* retainer) {
}
// Update the head of the list of contexts.
global_contexts_list_ = head;
native_contexts_list_ = head;
}
@ -1655,7 +1655,7 @@ class ScavengingVisitor : public StaticVisitorBase {
table_.Register(kVisitFixedArray, &EvacuateFixedArray);
table_.Register(kVisitFixedDoubleArray, &EvacuateFixedDoubleArray);
table_.Register(kVisitGlobalContext,
table_.Register(kVisitNativeContext,
&ObjectEvacuationStrategy<POINTER_OBJECT>::
template VisitSpecialized<Context::kSize>);
@ -2441,10 +2441,10 @@ bool Heap::CreateInitialMaps() {
AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
if (!maybe_obj->ToObject(&obj)) return false;
}
Map* global_context_map = Map::cast(obj);
global_context_map->set_dictionary_map(true);
global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext);
set_global_context_map(global_context_map);
Map* native_context_map = Map::cast(obj);
native_context_map->set_dictionary_map(true);
native_context_map->set_visitor_id(StaticVisitorBase::kVisitNativeContext);
set_native_context_map(native_context_map);
{ MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE,
SharedFunctionInfo::kAlignedSize);
@ -3723,7 +3723,7 @@ MaybeObject* Heap::AllocateFunctionPrototype(JSFunction* function) {
// from the function's context, since the function can be from a
// different context.
JSFunction* object_function =
function->context()->global_context()->object_function();
function->context()->native_context()->object_function();
// Each function prototype gets a copy of the object function map.
// This avoid unwanted sharing of maps between prototypes of different
@ -3773,12 +3773,12 @@ MaybeObject* Heap::AllocateArgumentsObject(Object* callee, int length) {
!JSFunction::cast(callee)->shared()->is_classic_mode();
if (strict_mode_callee) {
boilerplate =
isolate()->context()->global_context()->
isolate()->context()->native_context()->
strict_mode_arguments_boilerplate();
arguments_object_size = kArgumentsObjectSizeStrict;
} else {
boilerplate =
isolate()->context()->global_context()->arguments_boilerplate();
isolate()->context()->native_context()->arguments_boilerplate();
arguments_object_size = kArgumentsObjectSize;
}
@ -4309,7 +4309,7 @@ MaybeObject* Heap::ReinitializeJSReceiver(
map->set_function_with_prototype(true);
InitializeFunction(JSFunction::cast(object), shared, the_hole_value());
JSFunction::cast(object)->set_context(
isolate()->context()->global_context());
isolate()->context()->native_context());
}
// Put in filler if the new object is smaller than the old.
@ -4604,10 +4604,10 @@ MaybeObject* Heap::AllocateRawTwoByteString(int length,
MaybeObject* Heap::AllocateJSArray(
ElementsKind elements_kind,
PretenureFlag pretenure) {
Context* global_context = isolate()->context()->global_context();
JSFunction* array_function = global_context->array_function();
Context* native_context = isolate()->context()->native_context();
JSFunction* array_function = native_context->array_function();
Map* map = array_function->initial_map();
Object* maybe_map_array = global_context->js_array_maps();
Object* maybe_map_array = native_context->js_array_maps();
if (!maybe_map_array->IsUndefined()) {
Object* maybe_transitioned_map =
FixedArray::cast(maybe_map_array)->get(elements_kind);
@ -4890,16 +4890,16 @@ MaybeObject* Heap::AllocateHashTable(int length, PretenureFlag pretenure) {
}
MaybeObject* Heap::AllocateGlobalContext() {
MaybeObject* Heap::AllocateNativeContext() {
Object* result;
{ MaybeObject* maybe_result =
AllocateFixedArray(Context::GLOBAL_CONTEXT_SLOTS);
AllocateFixedArray(Context::NATIVE_CONTEXT_SLOTS);
if (!maybe_result->ToObject(&result)) return maybe_result;
}
Context* context = reinterpret_cast<Context*>(result);
context->set_map_no_write_barrier(global_context_map());
context->set_map_no_write_barrier(native_context_map());
context->set_js_array_maps(undefined_value());
ASSERT(context->IsGlobalContext());
ASSERT(context->IsNativeContext());
ASSERT(result->IsContext());
return result;
}
@ -6163,7 +6163,7 @@ bool Heap::SetUp(bool create_heap_objects) {
// Create initial objects
if (!CreateInitialObjects()) return false;
global_contexts_list_ = undefined_value();
native_contexts_list_ = undefined_value();
}
LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity()));
@ -6690,8 +6690,8 @@ void PathTracer::TracePathFrom(Object** root) {
}
static bool SafeIsGlobalContext(HeapObject* obj) {
return obj->map() == obj->GetHeap()->raw_unchecked_global_context_map();
static bool SafeIsNativeContext(HeapObject* obj) {
return obj->map() == obj->GetHeap()->raw_unchecked_native_context_map();
}
@ -6713,7 +6713,7 @@ void PathTracer::MarkRecursively(Object** p, MarkVisitor* mark_visitor) {
return;
}
bool is_global_context = SafeIsGlobalContext(obj);
bool is_native_context = SafeIsNativeContext(obj);
// not visited yet
Map* map_p = reinterpret_cast<Map*>(HeapObject::cast(map));
@ -6723,7 +6723,7 @@ void PathTracer::MarkRecursively(Object** p, MarkVisitor* mark_visitor) {
obj->set_map_no_write_barrier(reinterpret_cast<Map*>(map_addr + kMarkTag));
// Scan the object body.
if (is_global_context && (visit_mode_ == VISIT_ONLY_STRONG)) {
if (is_native_context && (visit_mode_ == VISIT_ONLY_STRONG)) {
// This is specialized to scan Context's properly.
Object** start = reinterpret_cast<Object**>(obj->address() +
Context::kHeaderSize);

View File

@ -64,7 +64,7 @@ namespace internal {
V(Map, ascii_symbol_map, AsciiSymbolMap) \
V(Map, ascii_string_map, AsciiStringMap) \
V(Map, heap_number_map, HeapNumberMap) \
V(Map, global_context_map, GlobalContextMap) \
V(Map, native_context_map, NativeContextMap) \
V(Map, fixed_array_map, FixedArrayMap) \
V(Map, code_map, CodeMap) \
V(Map, scope_info_map, ScopeInfoMap) \
@ -822,8 +822,8 @@ class Heap {
MUST_USE_RESULT MaybeObject* AllocateHashTable(
int length, PretenureFlag pretenure = NOT_TENURED);
// Allocate a global (but otherwise uninitialized) context.
MUST_USE_RESULT MaybeObject* AllocateGlobalContext();
// Allocate a native (but otherwise uninitialized) context.
MUST_USE_RESULT MaybeObject* AllocateNativeContext();
// Allocate a module context.
MUST_USE_RESULT MaybeObject* AllocateModuleContext(ScopeInfo* scope_info);
@ -1149,10 +1149,10 @@ class Heap {
// not match the empty string.
String* hidden_symbol() { return hidden_symbol_; }
void set_global_contexts_list(Object* object) {
global_contexts_list_ = object;
void set_native_contexts_list(Object* object) {
native_contexts_list_ = object;
}
Object* global_contexts_list() { return global_contexts_list_; }
Object* native_contexts_list() { return native_contexts_list_; }
// Number of mark-sweeps.
unsigned int ms_count() { return ms_count_; }
@ -1226,9 +1226,9 @@ class Heap {
return reinterpret_cast<Address*>(&roots_[kStoreBufferTopRootIndex]);
}
// Get address of global contexts list for serialization support.
Object** global_contexts_list_address() {
return &global_contexts_list_;
// Get address of native contexts list for serialization support.
Object** native_contexts_list_address() {
return &native_contexts_list_;
}
#ifdef DEBUG
@ -1776,7 +1776,7 @@ class Heap {
// last GC.
int old_gen_exhausted_;
Object* global_contexts_list_;
Object* native_contexts_list_;
StoreBufferRebuilder store_buffer_rebuilder_;

View File

@ -6823,7 +6823,7 @@ bool HGraphBuilder::TryInline(CallKind call_kind,
ASSERT(target_shared->has_deoptimization_support());
TypeFeedbackOracle target_oracle(
Handle<Code>(target_shared->code()),
Handle<Context>(target->context()->global_context()),
Handle<Context>(target->context()->native_context()),
isolate(),
zone());
// The function state is new-allocated because we need to delete it

View File

@ -680,7 +680,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
const int kGlobalIndex =
Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
__ mov(ebx, FieldOperand(esi, kGlobalIndex));
__ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalContextOffset));
__ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset));
__ mov(ebx, FieldOperand(ebx, kGlobalIndex));
__ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset));
@ -858,7 +858,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
const int kGlobalOffset =
Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
__ mov(ebx, FieldOperand(esi, kGlobalOffset));
__ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalContextOffset));
__ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset));
__ mov(ebx, FieldOperand(ebx, kGlobalOffset));
__ mov(ebx, FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset));

View File

@ -80,10 +80,10 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
? Context::FUNCTION_MAP_INDEX
: Context::STRICT_MODE_FUNCTION_MAP_INDEX;
// Compute the function map in the current global context and set that
// Compute the function map in the current native context and set that
// as the map of the allocated object.
__ mov(ecx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalContextOffset));
__ mov(ecx, FieldOperand(ecx, GlobalObject::kNativeContextOffset));
__ mov(ebx, Operand(ecx, Context::SlotOffset(map_index)));
__ mov(FieldOperand(eax, JSObject::kMapOffset), ebx);
@ -123,8 +123,8 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
__ IncrementCounter(counters->fast_new_closure_try_optimized(), 1);
// ecx holds global context, ebx points to fixed array of 3-element entries
// (global context, optimized code, literals).
// ecx holds native context, ebx points to fixed array of 3-element entries
// (native context, optimized code, literals).
// Map must never be empty, so check the first elements.
Label install_optimized;
// Speculatively move code object into edx.
@ -261,9 +261,9 @@ void FastNewBlockContextStub::Generate(MacroAssembler* masm) {
__ mov(FieldOperand(eax, Context::kLengthOffset),
Immediate(Smi::FromInt(length)));
// If this block context is nested in the global context we get a smi
// If this block context is nested in the native context we get a smi
// sentinel instead of a function. The block context should get the
// canonical empty function of the global context as its closure which
// canonical empty function of the native context as its closure which
// we still have to look up.
Label after_sentinel;
__ JumpIfNotSmi(ecx, &after_sentinel, Label::kNear);
@ -273,7 +273,7 @@ void FastNewBlockContextStub::Generate(MacroAssembler* masm) {
__ Assert(equal, message);
}
__ mov(ecx, GlobalObjectOperand());
__ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalContextOffset));
__ mov(ecx, FieldOperand(ecx, GlobalObject::kNativeContextOffset));
__ mov(ecx, ContextOperand(ecx, Context::CLOSURE_INDEX));
__ bind(&after_sentinel);
@ -3437,7 +3437,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
// Get the arguments boilerplate from the current (global) context into edi.
Label has_mapped_parameters, copy;
__ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ mov(edi, FieldOperand(edi, GlobalObject::kGlobalContextOffset));
__ mov(edi, FieldOperand(edi, GlobalObject::kNativeContextOffset));
__ mov(ebx, Operand(esp, 0 * kPointerSize));
__ test(ebx, ebx);
__ j(not_zero, &has_mapped_parameters, Label::kNear);
@ -3629,7 +3629,7 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
// Get the arguments boilerplate from the current (global) context.
__ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ mov(edi, FieldOperand(edi, GlobalObject::kGlobalContextOffset));
__ mov(edi, FieldOperand(edi, GlobalObject::kNativeContextOffset));
const int offset =
Context::SlotOffset(Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX);
__ mov(edi, Operand(edi, offset));
@ -4146,7 +4146,7 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) {
Factory* factory = masm->isolate()->factory();
__ mov(ecx, Immediate(factory->empty_fixed_array()));
__ lea(ebx, Operand(eax, JSRegExpResult::kSize));
__ mov(edx, FieldOperand(edx, GlobalObject::kGlobalContextOffset));
__ mov(edx, FieldOperand(edx, GlobalObject::kNativeContextOffset));
__ mov(FieldOperand(eax, JSObject::kElementsOffset), ebx);
__ mov(FieldOperand(eax, JSObject::kPropertiesOffset), ecx);
__ mov(edx, ContextOperand(edx, Context::REGEXP_RESULT_MAP_INDEX));

View File

@ -200,7 +200,7 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
// Iterate over all the functions which share the same code object
// and make them use unoptimized version.
Context* context = function->context()->global_context();
Context* context = function->context()->native_context();
Object* element = context->get(Context::OPTIMIZED_FUNCTIONS_LIST);
SharedFunctionInfo* shared = function->shared();
while (!element->IsUndefined()) {

View File

@ -1265,9 +1265,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
__ mov(temp, context);
}
__ bind(&next);
// Terminate at global context.
// Terminate at native context.
__ cmp(FieldOperand(temp, HeapObject::kMapOffset),
Immediate(isolate()->factory()->global_context_map()));
Immediate(isolate()->factory()->native_context_map()));
__ j(equal, &fast, Label::kNear);
// Check that extension is NULL.
__ cmp(ContextOperand(temp, Context::EXTENSION_INDEX), Immediate(0));
@ -2696,7 +2696,7 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
__ mov(ecx, FieldOperand(ecx, HeapObject::kMapOffset));
__ mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ mov(edx,
FieldOperand(edx, GlobalObject::kGlobalContextOffset));
FieldOperand(edx, GlobalObject::kNativeContextOffset));
__ cmp(ecx,
ContextOperand(edx,
Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
@ -2972,7 +2972,7 @@ void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) {
__ PrepareCallCFunction(1, ebx);
__ mov(eax, ContextOperand(context_register(), Context::GLOBAL_INDEX));
__ mov(eax, FieldOperand(eax, GlobalObject::kGlobalContextOffset));
__ mov(eax, FieldOperand(eax, GlobalObject::kNativeContextOffset));
__ mov(Operand(esp, 0), eax);
__ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
@ -3403,7 +3403,7 @@ void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value();
Handle<FixedArray> jsfunction_result_caches(
isolate()->global_context()->jsfunction_result_caches());
isolate()->native_context()->jsfunction_result_caches());
if (jsfunction_result_caches->length() <= cache_id) {
__ Abort("Attempt to use undefined cache.");
__ mov(eax, isolate()->factory()->undefined_value());
@ -3418,7 +3418,7 @@ void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
Register tmp = ecx;
__ mov(cache, ContextOperand(esi, Context::GLOBAL_INDEX));
__ mov(cache,
FieldOperand(cache, GlobalObject::kGlobalContextOffset));
FieldOperand(cache, GlobalObject::kNativeContextOffset));
__ mov(cache, ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX));
__ mov(cache,
FieldOperand(cache, FixedArray::OffsetOfElementAt(cache_id)));
@ -4438,7 +4438,7 @@ void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
Scope* declaration_scope = scope()->DeclarationScope();
if (declaration_scope->is_global_scope() ||
declaration_scope->is_module_scope()) {
// Contexts nested in the global context have a canonical empty function
// Contexts nested in the native context have a canonical empty function
// as their closure, not the anonymous closure containing the global
// code. Pass a smi sentinel and let the runtime look up the empty
// function.

View File

@ -3420,11 +3420,11 @@ void LCodeGen::DoRandom(LRandom* instr) {
static const int kSeedSize = sizeof(uint32_t);
STATIC_ASSERT(kPointerSize == kSeedSize);
__ mov(eax, FieldOperand(eax, GlobalObject::kGlobalContextOffset));
__ mov(eax, FieldOperand(eax, GlobalObject::kNativeContextOffset));
static const int kRandomSeedOffset =
FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize;
__ mov(ebx, FieldOperand(eax, kRandomSeedOffset));
// ebx: FixedArray of the global context's random seeds
// ebx: FixedArray of the native context's random seeds
// Load state[0].
__ mov(ecx, FieldOperand(ebx, ByteArray::kHeaderSize));

View File

@ -982,18 +982,18 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
cmp(scratch, Immediate(0));
Check(not_equal, "we should not have an empty lexical context");
}
// Load the global context of the current context.
// Load the native context of the current context.
int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
mov(scratch, FieldOperand(scratch, offset));
mov(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset));
mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset));
// Check the context is a global context.
// Check the context is a native context.
if (emit_debug_code()) {
push(scratch);
// Read the first word and compare to global_context_map.
// Read the first word and compare to native_context_map.
mov(scratch, FieldOperand(scratch, HeapObject::kMapOffset));
cmp(scratch, isolate()->factory()->global_context_map());
Check(equal, "JSGlobalObject::global_context should be a global context.");
cmp(scratch, isolate()->factory()->native_context_map());
Check(equal, "JSGlobalObject::native_context should be a native context.");
pop(scratch);
}
@ -1011,16 +1011,16 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
// object.
mov(holder_reg, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset));
// Check the context is a global context.
// Check the context is a native context.
if (emit_debug_code()) {
cmp(holder_reg, isolate()->factory()->null_value());
Check(not_equal, "JSGlobalProxy::context() should not be null.");
push(holder_reg);
// Read the first word and compare to global_context_map(),
// Read the first word and compare to native_context_map(),
mov(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset));
cmp(holder_reg, isolate()->factory()->global_context_map());
Check(equal, "JSGlobalObject::global_context should be a global context.");
cmp(holder_reg, isolate()->factory()->native_context_map());
Check(equal, "JSGlobalObject::native_context should be a native context.");
pop(holder_reg);
}
@ -2220,7 +2220,7 @@ void MacroAssembler::LoadTransitionedArrayMapConditional(
Label* no_map_match) {
// Load the global or builtins object from the current context.
mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
mov(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset));
mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset));
// Check that the function's map is the same as the expected cached map.
mov(scratch, Operand(scratch,
@ -2266,9 +2266,9 @@ void MacroAssembler::LoadInitialArrayMap(
void MacroAssembler::LoadGlobalFunction(int index, Register function) {
// Load the global or builtins object from the current context.
mov(function, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
// Load the global context from the global or builtins object.
mov(function, FieldOperand(function, GlobalObject::kGlobalContextOffset));
// Load the function from the global context.
// Load the native context from the global or builtins object.
mov(function, FieldOperand(function, GlobalObject::kNativeContextOffset));
// Load the function from the native context.
mov(function, Operand(function, Context::SlotOffset(index)));
}

View File

@ -239,8 +239,8 @@ class MacroAssembler: public Assembler {
void LoadContext(Register dst, int context_chain_length);
// Conditionally load the cached Array transitioned map of type
// transitioned_kind from the global context if the map in register
// map_in_out is the cached Array map in the global context of
// transitioned_kind from the native context if the map in register
// map_in_out is the cached Array map in the native context of
// expected_kind.
void LoadTransitionedArrayMapConditional(
ElementsKind expected_kind,

View File

@ -281,7 +281,7 @@ void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
__ j(not_equal, miss);
// Get the global function with the given index.
Handle<JSFunction> function(
JSFunction::cast(masm->isolate()->global_context()->get(index)));
JSFunction::cast(masm->isolate()->native_context()->get(index)));
// Load its initial map. The global functions all have initial maps.
__ Set(prototype, Immediate(Handle<Map>(function->initial_map())));
// Load the prototype from the initial map.

View File

@ -629,7 +629,7 @@ void IncrementalMarking::Hurry() {
// TODO(gc) hurry can mark objects it encounters black as mutator
// was stopped.
Map* filler_map = heap_->one_pointer_filler_map();
Map* global_context_map = heap_->global_context_map();
Map* native_context_map = heap_->native_context_map();
while (!marking_deque_.IsEmpty()) {
HeapObject* obj = marking_deque_.Pop();
@ -638,9 +638,9 @@ void IncrementalMarking::Hurry() {
Map* map = obj->map();
if (map == filler_map) {
continue;
} else if (map == global_context_map) {
// Global contexts have weak fields.
IncrementalMarkingMarkingVisitor::VisitGlobalContext(map, obj);
} else if (map == native_context_map) {
// Native contexts have weak fields.
IncrementalMarkingMarkingVisitor::VisitNativeContext(map, obj);
} else if (map->instance_type() == MAP_TYPE) {
Map* map = Map::cast(obj);
heap_->ClearCacheOnMap(map);
@ -686,7 +686,7 @@ void IncrementalMarking::Hurry() {
PolymorphicCodeCache::kSize);
}
Object* context = heap_->global_contexts_list();
Object* context = heap_->native_contexts_list();
while (!context->IsUndefined()) {
// GC can happen when the context is not fully initialized,
// so the cache can be undefined.
@ -796,7 +796,7 @@ void IncrementalMarking::Step(intptr_t allocated_bytes,
}
} else if (state_ == MARKING) {
Map* filler_map = heap_->one_pointer_filler_map();
Map* global_context_map = heap_->global_context_map();
Map* native_context_map = heap_->native_context_map();
while (!marking_deque_.IsEmpty() && bytes_to_process > 0) {
HeapObject* obj = marking_deque_.Pop();
@ -813,15 +813,15 @@ void IncrementalMarking::Step(intptr_t allocated_bytes,
}
// TODO(gc) switch to static visitor instead of normal visitor.
if (map == global_context_map) {
// Global contexts have weak fields.
if (map == native_context_map) {
// Native contexts have weak fields.
Context* ctx = Context::cast(obj);
// We will mark cache black with a separate pass
// when we finish marking.
MarkObjectGreyDoNotEnqueue(ctx->normalized_map_cache());
IncrementalMarkingMarkingVisitor::VisitGlobalContext(map, ctx);
IncrementalMarkingMarkingVisitor::VisitNativeContext(map, ctx);
} else if (map->instance_type() == MAP_TYPE) {
Map* map = Map::cast(obj);
heap_->ClearCacheOnMap(map);

View File

@ -792,13 +792,13 @@ static MayAccessDecision MayAccessPreCheck(Isolate* isolate,
Object* receiver_context = JSGlobalProxy::cast(receiver)->context();
if (!receiver_context->IsContext()) return NO;
// Get the global context of current top context.
// avoid using Isolate::global_context() because it uses Handle.
Context* global_context = isolate->context()->global()->global_context();
if (receiver_context == global_context) return YES;
// Get the native context of current top context.
// avoid using Isolate::native_context() because it uses Handle.
Context* native_context = isolate->context()->global()->native_context();
if (receiver_context == native_context) return YES;
if (Context::cast(receiver_context)->security_token() ==
global_context->security_token())
native_context->security_token())
return YES;
}
@ -1213,7 +1213,7 @@ void Isolate::ReportPendingMessages() {
PropagatePendingExceptionToExternalTryCatch();
// If the pending exception is OutOfMemoryException set out_of_memory in
// the global context. Note: We have to mark the global context here
// the native context. Note: We have to mark the native context here
// since the GenerateThrowOutOfMemory stub cannot make a RuntimeCall to
// set it.
HandleScope scope;
@ -1323,20 +1323,20 @@ bool Isolate::is_out_of_memory() {
}
Handle<Context> Isolate::global_context() {
Handle<Context> Isolate::native_context() {
GlobalObject* global = thread_local_top()->context_->global();
return Handle<Context>(global->global_context());
return Handle<Context>(global->native_context());
}
Handle<Context> Isolate::GetCallingGlobalContext() {
Handle<Context> Isolate::GetCallingNativeContext() {
JavaScriptFrameIterator it;
#ifdef ENABLE_DEBUGGER_SUPPORT
if (debug_->InDebugger()) {
while (!it.done()) {
JavaScriptFrame* frame = it.frame();
Context* context = Context::cast(frame->context());
if (context->global_context() == *debug_->debug_context()) {
if (context->native_context() == *debug_->debug_context()) {
it.Advance();
} else {
break;
@ -1347,7 +1347,7 @@ Handle<Context> Isolate::GetCallingGlobalContext() {
if (it.done()) return Handle<Context>::null();
JavaScriptFrame* frame = it.frame();
Context* context = Context::cast(frame->context());
return Handle<Context>(context->global_context());
return Handle<Context>(context->native_context());
}

View File

@ -329,7 +329,7 @@ typedef List<HeapObject*, PreallocatedStorageAllocationPolicy> DebugObjectCache;
V(AllowCodeGenerationFromStringsCallback, allow_code_gen_callback, NULL) \
V(v8::Debug::MessageHandler, message_handler, NULL) \
/* To distinguish the function templates, so that we can find them in the */ \
/* function cache of the global context. */ \
/* function cache of the native context. */ \
V(int, next_serial_number, 0) \
V(ExternalReferenceRedirectorPointer*, external_reference_redirector, NULL) \
V(bool, always_allow_natives_syntax, false) \
@ -531,7 +531,7 @@ class Isolate {
// Access to the map of "new Object()".
Map* empty_object_map() {
return context()->global_context()->object_function()->map();
return context()->native_context()->object_function()->map();
}
// Access to current thread id.
@ -764,12 +764,12 @@ class Isolate {
void IterateThread(ThreadVisitor* v, char* t);
// Returns the current global context.
Handle<Context> global_context();
// Returns the current native context.
Handle<Context> native_context();
// Returns the global context of the calling JavaScript code. That
// is, the global context of the top-most JavaScript frame.
Handle<Context> GetCallingGlobalContext();
// Returns the native context of the calling JavaScript code. That
// is, the native context of the top-most JavaScript frame.
Handle<Context> GetCallingNativeContext();
void RegisterTryCatchHandler(v8::TryCatch* that);
void UnregisterTryCatchHandler(v8::TryCatch* that);
@ -803,12 +803,12 @@ class Isolate {
ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_ACCESSOR)
#undef GLOBAL_ARRAY_ACCESSOR
#define GLOBAL_CONTEXT_FIELD_ACCESSOR(index, type, name) \
#define NATIVE_CONTEXT_FIELD_ACCESSOR(index, type, name) \
Handle<type> name() { \
return Handle<type>(context()->global_context()->name()); \
return Handle<type>(context()->native_context()->name()); \
}
GLOBAL_CONTEXT_FIELDS(GLOBAL_CONTEXT_FIELD_ACCESSOR)
#undef GLOBAL_CONTEXT_FIELD_ACCESSOR
NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR)
#undef NATIVE_CONTEXT_FIELD_ACCESSOR
Bootstrapper* bootstrapper() { return bootstrapper_; }
Counters* counters() {
@ -1434,15 +1434,15 @@ class PostponeInterruptsScope BASE_EMBEDDED {
#define LOGGER (v8::internal::Isolate::Current()->logger())
// Tells whether the global context is marked with out of memory.
// Tells whether the native context is marked with out of memory.
inline bool Context::has_out_of_memory() {
return global_context()->out_of_memory()->IsTrue();
return native_context()->out_of_memory()->IsTrue();
}
// Mark the global context with out of memory.
// Mark the native context with out of memory.
inline void Context::mark_out_of_memory() {
global_context()->set_out_of_memory(HEAP->true_value());
native_context()->set_out_of_memory(HEAP->true_value());
}

View File

@ -290,7 +290,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonValue() {
template <bool seq_ascii>
Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
Handle<JSFunction> object_constructor(
isolate()->global_context()->object_function());
isolate()->native_context()->object_function());
Handle<JSObject> json_object =
isolate()->factory()->NewJSObject(object_constructor);
ASSERT_EQ(c0_, '{');

View File

@ -74,7 +74,7 @@ typedef int (*RawComparer)(const void*, const void*);
v(SeqAsciiString, "unexpected: SeqAsciiString") \
v(SeqString, "unexpected: SeqString") \
v(JSFunctionResultCache, "unexpected: JSFunctionResultCache") \
v(GlobalContext, "unexpected: GlobalContext") \
v(NativeContext, "unexpected: NativeContext") \
v(MapCache, "unexpected: MapCache") \
v(CodeCacheHashTable, "unexpected: CodeCacheHashTable") \
v(CompilationCacheTable, "unexpected: CompilationCacheTable") \
@ -1951,7 +1951,7 @@ MaybeObject* LiveObjectList::GetObjRetainers(int obj_id,
// Get the constructor function for context extension and arguments array.
JSObject* arguments_boilerplate =
isolate->context()->global_context()->arguments_boilerplate();
isolate->context()->native_context()->arguments_boilerplate();
JSFunction* arguments_function =
JSFunction::cast(arguments_boilerplate->map()->constructor());

View File

@ -224,9 +224,9 @@ static void VerifyEvacuation(Heap* heap) {
}
class VerifyGlobalContextSeparationVisitor: public ObjectVisitor {
class VerifyNativeContextSeparationVisitor: public ObjectVisitor {
public:
VerifyGlobalContextSeparationVisitor() : current_global_context_(NULL) {}
VerifyNativeContextSeparationVisitor() : current_native_context_(NULL) {}
void VisitPointers(Object** start, Object** end) {
for (Object** current = start; current < end; current++) {
@ -242,7 +242,7 @@ class VerifyGlobalContextSeparationVisitor: public ObjectVisitor {
break;
case JS_GLOBAL_OBJECT_TYPE:
case JS_BUILTINS_OBJECT_TYPE:
CheckContext(GlobalObject::cast(object)->global_context());
CheckContext(GlobalObject::cast(object)->native_context());
break;
case JS_ARRAY_TYPE:
case JS_DATE_TYPE:
@ -295,23 +295,23 @@ class VerifyGlobalContextSeparationVisitor: public ObjectVisitor {
private:
void CheckContext(Object* context) {
if (!context->IsContext()) return;
Context* global_context = Context::cast(context)->global_context();
if (current_global_context_ == NULL) {
current_global_context_ = global_context;
Context* native_context = Context::cast(context)->native_context();
if (current_native_context_ == NULL) {
current_native_context_ = native_context;
} else {
CHECK_EQ(current_global_context_, global_context);
CHECK_EQ(current_native_context_, native_context);
}
}
Context* current_global_context_;
Context* current_native_context_;
};
static void VerifyGlobalContextSeparation(Heap* heap) {
static void VerifyNativeContextSeparation(Heap* heap) {
HeapObjectIterator it(heap->code_space());
for (Object* object = it.Next(); object != NULL; object = it.Next()) {
VerifyGlobalContextSeparationVisitor visitor;
VerifyNativeContextSeparationVisitor visitor;
Code::cast(object)->CodeIterateBody(&visitor);
}
}
@ -389,8 +389,8 @@ void MarkCompactCollector::CollectGarbage() {
if (!FLAG_collect_maps) ReattachInitialMaps();
#ifdef DEBUG
if (FLAG_verify_global_context_separation) {
VerifyGlobalContextSeparation(heap_);
if (FLAG_verify_native_context_separation) {
VerifyNativeContextSeparation(heap_);
}
#endif
@ -2423,7 +2423,7 @@ void MarkCompactCollector::AfterMarking() {
void MarkCompactCollector::ProcessMapCaches() {
Object* raw_context = heap()->global_contexts_list_;
Object* raw_context = heap()->native_contexts_list_;
while (raw_context != heap()->undefined_value()) {
Context* context = reinterpret_cast<Context*>(raw_context);
if (IsMarked(context)) {
@ -3404,8 +3404,8 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
}
}
// Update pointer from the global contexts list.
updating_visitor.VisitPointer(heap_->global_contexts_list_address());
// Update pointer from the native contexts list.
updating_visitor.VisitPointer(heap_->native_contexts_list_address());
heap_->symbol_table()->Iterate(&updating_visitor);

View File

@ -79,12 +79,12 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm,
// Load the built-in InternalArray function from the current context.
static void GenerateLoadInternalArrayFunction(MacroAssembler* masm,
Register result) {
// Load the global context.
// Load the native context.
__ lw(result, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ lw(result,
FieldMemOperand(result, GlobalObject::kGlobalContextOffset));
// Load the InternalArray function from the global context.
FieldMemOperand(result, GlobalObject::kNativeContextOffset));
// Load the InternalArray function from the native context.
__ lw(result,
MemOperand(result,
Context::SlotOffset(
@ -94,12 +94,12 @@ static void GenerateLoadInternalArrayFunction(MacroAssembler* masm,
// Load the built-in Array function from the current context.
static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) {
// Load the global context.
// Load the native context.
__ lw(result, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ lw(result,
FieldMemOperand(result, GlobalObject::kGlobalContextOffset));
// Load the Array function from the global context.
FieldMemOperand(result, GlobalObject::kNativeContextOffset));
// Load the Array function from the native context.
__ lw(result,
MemOperand(result,
Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX)));
@ -1432,7 +1432,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
const int kGlobalIndex =
Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
__ lw(a2, FieldMemOperand(cp, kGlobalIndex));
__ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalContextOffset));
__ lw(a2, FieldMemOperand(a2, GlobalObject::kNativeContextOffset));
__ lw(a2, FieldMemOperand(a2, kGlobalIndex));
__ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalReceiverOffset));
@ -1625,7 +1625,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
const int kGlobalOffset =
Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
__ lw(a0, FieldMemOperand(cp, kGlobalOffset));
__ lw(a0, FieldMemOperand(a0, GlobalObject::kGlobalContextOffset));
__ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset));
__ lw(a0, FieldMemOperand(a0, kGlobalOffset));
__ lw(a0, FieldMemOperand(a0, GlobalObject::kGlobalReceiverOffset));

View File

@ -108,10 +108,10 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
? Context::FUNCTION_MAP_INDEX
: Context::STRICT_MODE_FUNCTION_MAP_INDEX;
// Compute the function map in the current global context and set that
// Compute the function map in the current native context and set that
// as the map of the allocated object.
__ lw(a2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalContextOffset));
__ lw(a2, FieldMemOperand(a2, GlobalObject::kNativeContextOffset));
__ lw(t1, MemOperand(a2, Context::SlotOffset(map_index)));
__ sw(t1, FieldMemOperand(v0, HeapObject::kMapOffset));
@ -151,8 +151,8 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
__ IncrementCounter(counters->fast_new_closure_try_optimized(), 1, t2, t3);
// a2 holds global context, a1 points to fixed array of 3-element entries
// (global context, optimized code, literals).
// a2 holds native context, a1 points to fixed array of 3-element entries
// (native context, optimized code, literals).
// The optimized code map must never be empty, so check the first elements.
Label install_optimized;
// Speculatively move code object into t0.
@ -291,9 +291,9 @@ void FastNewBlockContextStub::Generate(MacroAssembler* masm) {
__ li(a2, Operand(Smi::FromInt(length)));
__ sw(a2, FieldMemOperand(v0, FixedArray::kLengthOffset));
// If this block context is nested in the global context we get a smi
// If this block context is nested in the native context we get a smi
// sentinel instead of a function. The block context should get the
// canonical empty function of the global context as its closure which
// canonical empty function of the native context as its closure which
// we still have to look up.
Label after_sentinel;
__ JumpIfNotSmi(a3, &after_sentinel);
@ -302,7 +302,7 @@ void FastNewBlockContextStub::Generate(MacroAssembler* masm) {
__ Assert(eq, message, a3, Operand(zero_reg));
}
__ lw(a3, GlobalObjectOperand());
__ lw(a3, FieldMemOperand(a3, GlobalObject::kGlobalContextOffset));
__ lw(a3, FieldMemOperand(a3, GlobalObject::kNativeContextOffset));
__ lw(a3, ContextOperand(a3, Context::CLOSURE_INDEX));
__ bind(&after_sentinel);
@ -4653,7 +4653,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX);
__ lw(t0, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ lw(t0, FieldMemOperand(t0, GlobalObject::kGlobalContextOffset));
__ lw(t0, FieldMemOperand(t0, GlobalObject::kNativeContextOffset));
Label skip2_ne, skip2_eq;
__ Branch(&skip2_ne, ne, a1, Operand(zero_reg));
__ lw(t0, MemOperand(t0, kNormalOffset));
@ -4843,7 +4843,7 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
// Get the arguments boilerplate from the current (global) context.
__ lw(t0, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ lw(t0, FieldMemOperand(t0, GlobalObject::kGlobalContextOffset));
__ lw(t0, FieldMemOperand(t0, GlobalObject::kNativeContextOffset));
__ lw(t0, MemOperand(t0, Context::SlotOffset(
Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX)));
@ -5380,7 +5380,7 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) {
__ lw(a2, ContextOperand(cp, Context::GLOBAL_INDEX));
__ Addu(a3, v0, Operand(JSRegExpResult::kSize));
__ li(t0, Operand(masm->isolate()->factory()->empty_fixed_array()));
__ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalContextOffset));
__ lw(a2, FieldMemOperand(a2, GlobalObject::kNativeContextOffset));
__ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset));
__ lw(a2, ContextOperand(a2, Context::REGEXP_RESULT_MAP_INDEX));
__ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset));

View File

@ -102,7 +102,7 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
// Iterate over all the functions which share the same code object
// and make them use unoptimized version.
Context* context = function->context()->global_context();
Context* context = function->context()->native_context();
Object* element = context->get(Context::OPTIMIZED_FUNCTIONS_LIST);
SharedFunctionInfo* shared = function->shared();
while (!element->IsUndefined()) {

View File

@ -1322,9 +1322,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
__ Move(next, current);
}
__ bind(&loop);
// Terminate at global context.
// Terminate at native context.
__ lw(temp, FieldMemOperand(next, HeapObject::kMapOffset));
__ LoadRoot(t0, Heap::kGlobalContextMapRootIndex);
__ LoadRoot(t0, Heap::kNativeContextMapRootIndex);
__ Branch(&fast, eq, temp, Operand(t0));
// Check that extension is NULL.
__ lw(temp, ContextOperand(next, Context::EXTENSION_INDEX));
@ -2789,7 +2789,7 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
__ JumpIfSmi(a2, if_false);
__ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset));
__ lw(a3, ContextOperand(cp, Context::GLOBAL_INDEX));
__ lw(a3, FieldMemOperand(a3, GlobalObject::kGlobalContextOffset));
__ lw(a3, FieldMemOperand(a3, GlobalObject::kNativeContextOffset));
__ lw(a3, ContextOperand(a3, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
__ Branch(if_false, ne, a2, Operand(a3));
@ -3070,7 +3070,7 @@ void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) {
if (CpuFeatures::IsSupported(FPU)) {
__ PrepareCallCFunction(1, a0);
__ lw(a0, ContextOperand(cp, Context::GLOBAL_INDEX));
__ lw(a0, FieldMemOperand(a0, GlobalObject::kGlobalContextOffset));
__ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset));
__ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
CpuFeatures::Scope scope(FPU);
@ -3088,7 +3088,7 @@ void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) {
__ PrepareCallCFunction(2, a0);
__ mov(a0, s0);
__ lw(a1, ContextOperand(cp, Context::GLOBAL_INDEX));
__ lw(a1, FieldMemOperand(a1, GlobalObject::kGlobalContextOffset));
__ lw(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset));
__ CallCFunction(
ExternalReference::fill_heap_number_with_random_function(isolate()), 2);
}
@ -3503,7 +3503,7 @@ void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value();
Handle<FixedArray> jsfunction_result_caches(
isolate()->global_context()->jsfunction_result_caches());
isolate()->native_context()->jsfunction_result_caches());
if (jsfunction_result_caches->length() <= cache_id) {
__ Abort("Attempt to use undefined cache.");
__ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
@ -3516,7 +3516,7 @@ void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
Register key = v0;
Register cache = a1;
__ lw(cache, ContextOperand(cp, Context::GLOBAL_INDEX));
__ lw(cache, FieldMemOperand(cache, GlobalObject::kGlobalContextOffset));
__ lw(cache, FieldMemOperand(cache, GlobalObject::kNativeContextOffset));
__ lw(cache,
ContextOperand(
cache, Context::JSFUNCTION_RESULT_CACHES_INDEX));
@ -4495,7 +4495,7 @@ void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
Scope* declaration_scope = scope()->DeclarationScope();
if (declaration_scope->is_global_scope() ||
declaration_scope->is_module_scope()) {
// Contexts nested in the global context have a canonical empty function
// Contexts nested in the native context have a canonical empty function
// as their closure, not the anonymous closure containing the global
// code. Pass a smi sentinel and let the runtime look up the empty
// function.

View File

@ -3365,11 +3365,11 @@ void LCodeGen::DoRandom(LRandom* instr) {
static const int kSeedSize = sizeof(uint32_t);
STATIC_ASSERT(kPointerSize == kSeedSize);
__ lw(a0, FieldMemOperand(a0, GlobalObject::kGlobalContextOffset));
__ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset));
static const int kRandomSeedOffset =
FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize;
__ lw(a2, FieldMemOperand(a0, kRandomSeedOffset));
// a2: FixedArray of the global context's random seeds
// a2: FixedArray of the native context's random seeds
// Load state[0].
__ lw(a1, FieldMemOperand(a2, ByteArray::kHeaderSize));

View File

@ -361,19 +361,19 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
scratch, Operand(zero_reg));
#endif
// Load the global context of the current context.
// Load the native context of the current context.
int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
lw(scratch, FieldMemOperand(scratch, offset));
lw(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset));
lw(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset));
// Check the context is a global context.
// Check the context is a native context.
if (emit_debug_code()) {
// TODO(119): Avoid push(holder_reg)/pop(holder_reg).
push(holder_reg); // Temporarily save holder on the stack.
// Read the first word and compare to the global_context_map.
// Read the first word and compare to the native_context_map.
lw(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset));
LoadRoot(at, Heap::kGlobalContextMapRootIndex);
Check(eq, "JSGlobalObject::global_context should be a global context.",
LoadRoot(at, Heap::kNativeContextMapRootIndex);
Check(eq, "JSGlobalObject::native_context should be a native context.",
holder_reg, Operand(at));
pop(holder_reg); // Restore holder.
}
@ -382,7 +382,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset));
Branch(&same_contexts, eq, scratch, Operand(at));
// Check the context is a global context.
// Check the context is a native context.
if (emit_debug_code()) {
// TODO(119): Avoid push(holder_reg)/pop(holder_reg).
push(holder_reg); // Temporarily save holder on the stack.
@ -392,8 +392,8 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
holder_reg, Operand(at));
lw(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset));
LoadRoot(at, Heap::kGlobalContextMapRootIndex);
Check(eq, "JSGlobalObject::global_context should be a global context.",
LoadRoot(at, Heap::kNativeContextMapRootIndex);
Check(eq, "JSGlobalObject::native_context should be a native context.",
holder_reg, Operand(at));
// Restore at is not needed. at is reloaded below.
pop(holder_reg); // Restore holder.
@ -4452,7 +4452,7 @@ void MacroAssembler::LoadTransitionedArrayMapConditional(
Label* no_map_match) {
// Load the global or builtins object from the current context.
lw(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
lw(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset));
lw(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset));
// Check that the function's map is the same as the expected cached map.
lw(scratch,
@ -4498,10 +4498,10 @@ void MacroAssembler::LoadInitialArrayMap(
void MacroAssembler::LoadGlobalFunction(int index, Register function) {
// Load the global or builtins object from the current context.
lw(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
// Load the global context from the global or builtins object.
// Load the native context from the global or builtins object.
lw(function, FieldMemOperand(function,
GlobalObject::kGlobalContextOffset));
// Load the function from the global context.
GlobalObject::kNativeContextOffset));
// Load the function from the native context.
lw(function, MemOperand(function, Context::SlotOffset(index)));
}

View File

@ -806,8 +806,8 @@ class MacroAssembler: public Assembler {
void LoadContext(Register dst, int context_chain_length);
// Conditionally load the cached Array transitioned map of type
// transitioned_kind from the global context if the map in register
// map_in_out is the cached Array map in the global context of
// transitioned_kind from the native context if the map in register
// map_in_out is the cached Array map in the native context of
// expected_kind.
void LoadTransitionedArrayMapConditional(
ElementsKind expected_kind,

View File

@ -271,10 +271,10 @@ void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm,
Register prototype) {
// Load the global or builtins object from the current context.
__ lw(prototype, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
// Load the global context from the global or builtins object.
// Load the native context from the global or builtins object.
__ lw(prototype,
FieldMemOperand(prototype, GlobalObject::kGlobalContextOffset));
// Load the function from the global context.
FieldMemOperand(prototype, GlobalObject::kNativeContextOffset));
// Load the function from the native context.
__ lw(prototype, MemOperand(prototype, Context::SlotOffset(index)));
// Load the initial map. The global functions all have initial maps.
__ lw(prototype,
@ -297,7 +297,7 @@ void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
__ Branch(miss, ne, prototype, Operand(at));
// Get the global function with the given index.
Handle<JSFunction> function(
JSFunction::cast(isolate->global_context()->get(index)));
JSFunction::cast(isolate->native_context()->get(index)));
// Load its initial map. The global functions all have initial maps.
__ li(prototype, Handle<Map>(function->initial_map()));
// Load the prototype from the initial map.

View File

@ -574,7 +574,7 @@ bool Object::IsContext() {
return (map == heap->function_context_map() ||
map == heap->catch_context_map() ||
map == heap->with_context_map() ||
map == heap->global_context_map() ||
map == heap->native_context_map() ||
map == heap->block_context_map() ||
map == heap->module_context_map());
}
@ -582,10 +582,10 @@ bool Object::IsContext() {
}
bool Object::IsGlobalContext() {
bool Object::IsNativeContext() {
return Object::IsHeapObject() &&
HeapObject::cast(this)->map() ==
HeapObject::cast(this)->GetHeap()->global_context_map();
HeapObject::cast(this)->GetHeap()->native_context_map();
}
@ -1339,8 +1339,8 @@ MaybeObject* JSObject::GetElementsTransitionMap(Isolate* isolate,
ElementsKind from_kind = current_map->elements_kind();
if (from_kind == to_kind) return current_map;
Context* global_context = isolate->context()->global_context();
Object* maybe_array_maps = global_context->js_array_maps();
Context* native_context = isolate->context()->native_context();
Object* maybe_array_maps = native_context->js_array_maps();
if (maybe_array_maps->IsFixedArray()) {
FixedArray* array_maps = FixedArray::cast(maybe_array_maps);
if (array_maps->get(from_kind) == current_map) {
@ -3669,7 +3669,7 @@ ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset)
ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset)
ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset)
ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset)
ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset)
ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset)
ACCESSORS(JSGlobalProxy, context, Object, kContextOffset)
@ -4224,10 +4224,10 @@ void JSFunction::ReplaceCode(Code* code) {
// Add/remove the function from the list of optimized functions for this
// context based on the state change.
if (!was_optimized && is_optimized) {
context()->global_context()->AddOptimizedFunction(this);
context()->native_context()->AddOptimizedFunction(this);
}
if (was_optimized && !is_optimized) {
context()->global_context()->RemoveOptimizedFunction(this);
context()->native_context()->RemoveOptimizedFunction(this);
}
}
@ -4270,12 +4270,12 @@ void JSFunction::set_initial_map(Map* value) {
MaybeObject* JSFunction::set_initial_map_and_cache_transitions(
Map* initial_map) {
Context* global_context = context()->global_context();
Context* native_context = context()->native_context();
Object* array_function =
global_context->get(Context::ARRAY_FUNCTION_INDEX);
native_context->get(Context::ARRAY_FUNCTION_INDEX);
if (array_function->IsJSFunction() &&
this == JSFunction::cast(array_function)) {
// Replace all of the cached initial array maps in the global context with
// Replace all of the cached initial array maps in the native context with
// the appropriate transitioned elements kind maps.
Heap* heap = GetHeap();
MaybeObject* maybe_maps =
@ -4297,7 +4297,7 @@ MaybeObject* JSFunction::set_initial_map_and_cache_transitions(
maps->set(next_kind, new_map);
current_map = new_map;
}
global_context->set_js_array_maps(maps);
native_context->set_js_array_maps(maps);
}
set_initial_map(initial_map);
return this;

View File

@ -833,8 +833,8 @@ void JSGlobalProxy::JSGlobalProxyPrint(FILE* out) {
void JSGlobalObject::JSGlobalObjectPrint(FILE* out) {
PrintF(out, "global ");
JSObjectPrint(out);
PrintF(out, "global context : ");
global_context()->ShortPrint(out);
PrintF(out, "native context : ");
native_context()->ShortPrint(out);
PrintF(out, "\n");
}

View File

@ -56,7 +56,7 @@ void StaticNewSpaceVisitor<StaticVisitor>::Initialize() {
table_.Register(kVisitFixedDoubleArray, &VisitFixedDoubleArray);
table_.Register(kVisitGlobalContext,
table_.Register(kVisitNativeContext,
&FixedBodyVisitor<StaticVisitor,
Context::ScavengeBodyDescriptor,
int>::Visit);
@ -117,7 +117,7 @@ void StaticMarkingVisitor<StaticVisitor>::Initialize() {
table_.Register(kVisitFixedDoubleArray, &DataObjectVisitor::Visit);
table_.Register(kVisitGlobalContext, &VisitGlobalContext);
table_.Register(kVisitNativeContext, &VisitNativeContext);
table_.Register(kVisitByteArray, &DataObjectVisitor::Visit);
@ -229,7 +229,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget(
template<typename StaticVisitor>
void StaticMarkingVisitor<StaticVisitor>::VisitGlobalContext(
void StaticMarkingVisitor<StaticVisitor>::VisitNativeContext(
Map* map, HeapObject* object) {
FixedBodyVisitor<StaticVisitor,
Context::MarkCompactBodyDescriptor,
@ -237,7 +237,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitGlobalContext(
MarkCompactCollector* collector = map->GetHeap()->mark_compact_collector();
for (int idx = Context::FIRST_WEAK_SLOT;
idx < Context::GLOBAL_CONTEXT_SLOTS;
idx < Context::NATIVE_CONTEXT_SLOTS;
++idx) {
Object** slot =
HeapObject::RawField(object, FixedArray::OffsetOfElementAt(idx));

View File

@ -54,7 +54,7 @@ class StaticVisitorBase : public AllStatic {
V(FreeSpace) \
V(FixedArray) \
V(FixedDoubleArray) \
V(GlobalContext) \
V(NativeContext) \
V(DataObject2) \
V(DataObject3) \
V(DataObject4) \
@ -395,7 +395,7 @@ class StaticMarkingVisitor : public StaticVisitorBase {
static inline void VisitRuntimeEntry(RelocInfo* rinfo) { }
// TODO(mstarzinger): This should be made protected once refactoring is done.
static inline void VisitGlobalContext(Map* map, HeapObject* object);
static inline void VisitNativeContext(Map* map, HeapObject* object);
protected:
static inline void VisitCode(Map* map, HeapObject* object);

View File

@ -69,13 +69,13 @@ MUST_USE_RESULT static MaybeObject* CreateJSValue(JSFunction* constructor,
}
MaybeObject* Object::ToObject(Context* global_context) {
MaybeObject* Object::ToObject(Context* native_context) {
if (IsNumber()) {
return CreateJSValue(global_context->number_function(), this);
return CreateJSValue(native_context->number_function(), this);
} else if (IsBoolean()) {
return CreateJSValue(global_context->boolean_function(), this);
return CreateJSValue(native_context->boolean_function(), this);
} else if (IsString()) {
return CreateJSValue(global_context->string_function(), this);
return CreateJSValue(native_context->string_function(), this);
}
ASSERT(IsJSObject());
return this;
@ -87,16 +87,16 @@ MaybeObject* Object::ToObject() {
return this;
} else if (IsNumber()) {
Isolate* isolate = Isolate::Current();
Context* global_context = isolate->context()->global_context();
return CreateJSValue(global_context->number_function(), this);
Context* native_context = isolate->context()->native_context();
return CreateJSValue(native_context->number_function(), this);
} else if (IsBoolean()) {
Isolate* isolate = HeapObject::cast(this)->GetIsolate();
Context* global_context = isolate->context()->global_context();
return CreateJSValue(global_context->boolean_function(), this);
Context* native_context = isolate->context()->native_context();
return CreateJSValue(native_context->boolean_function(), this);
} else if (IsString()) {
Isolate* isolate = HeapObject::cast(this)->GetIsolate();
Context* global_context = isolate->context()->global_context();
return CreateJSValue(global_context->string_function(), this);
Context* native_context = isolate->context()->native_context();
return CreateJSValue(native_context->string_function(), this);
}
// Throw a type error.
@ -134,13 +134,13 @@ void Object::Lookup(String* name, LookupResult* result) {
if (IsJSReceiver()) {
holder = this;
} else {
Context* global_context = Isolate::Current()->context()->global_context();
Context* native_context = Isolate::Current()->context()->native_context();
if (IsNumber()) {
holder = global_context->number_function()->instance_prototype();
holder = native_context->number_function()->instance_prototype();
} else if (IsString()) {
holder = global_context->string_function()->instance_prototype();
holder = native_context->string_function()->instance_prototype();
} else if (IsBoolean()) {
holder = global_context->boolean_function()->instance_prototype();
holder = native_context->boolean_function()->instance_prototype();
}
}
ASSERT(holder != NULL); // Cannot handle null or undefined.
@ -662,13 +662,13 @@ MaybeObject* Object::GetElementWithReceiver(Object* receiver, uint32_t index) {
holder = holder->GetPrototype()) {
if (!holder->IsJSObject()) {
Isolate* isolate = heap->isolate();
Context* global_context = isolate->context()->global_context();
Context* native_context = isolate->context()->native_context();
if (holder->IsNumber()) {
holder = global_context->number_function()->instance_prototype();
holder = native_context->number_function()->instance_prototype();
} else if (holder->IsString()) {
holder = global_context->string_function()->instance_prototype();
holder = native_context->string_function()->instance_prototype();
} else if (holder->IsBoolean()) {
holder = global_context->boolean_function()->instance_prototype();
holder = native_context->boolean_function()->instance_prototype();
} else if (holder->IsJSProxy()) {
return JSProxy::cast(holder)->GetElementWithHandler(receiver, index);
} else {
@ -710,7 +710,7 @@ MaybeObject* Object::GetElementWithReceiver(Object* receiver, uint32_t index) {
Object* Object::GetPrototype() {
if (IsSmi()) {
Heap* heap = Isolate::Current()->heap();
Context* context = heap->isolate()->context()->global_context();
Context* context = heap->isolate()->context()->native_context();
return context->number_function()->instance_prototype();
}
@ -722,7 +722,7 @@ Object* Object::GetPrototype() {
return heap_object->map()->prototype();
}
Heap* heap = heap_object->GetHeap();
Context* context = heap->isolate()->context()->global_context();
Context* context = heap->isolate()->context()->native_context();
if (heap_object->IsHeapNumber()) {
return context->number_function()->instance_prototype();
@ -3342,7 +3342,7 @@ MaybeObject* JSObject::NormalizeProperties(PropertyNormalizationMode mode,
Map* new_map;
MaybeObject* maybe_map =
current_heap->isolate()->context()->global_context()->
current_heap->isolate()->context()->native_context()->
normalized_map_cache()->Get(this, mode);
if (!maybe_map->To(&new_map)) return maybe_map;
ASSERT(new_map->is_dictionary_map());
@ -4057,15 +4057,15 @@ bool JSObject::ReferencesObject(Object* obj) {
if (IsJSFunction()) {
// Get the constructor function for arguments array.
JSObject* arguments_boilerplate =
heap->isolate()->context()->global_context()->
heap->isolate()->context()->native_context()->
arguments_boilerplate();
JSFunction* arguments_function =
JSFunction::cast(arguments_boilerplate->map()->constructor());
// Get the context and don't check if it is the global context.
// Get the context and don't check if it is the native context.
JSFunction* f = JSFunction::cast(this);
Context* context = f->context();
if (context->IsGlobalContext()) {
if (context->IsNativeContext()) {
return false;
}
@ -7376,11 +7376,11 @@ void SharedFunctionInfo::ClearOptimizedCodeMap() {
void SharedFunctionInfo::AddToOptimizedCodeMap(
Handle<SharedFunctionInfo> shared,
Handle<Context> global_context,
Handle<Context> native_context,
Handle<Code> code,
Handle<FixedArray> literals) {
ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION);
ASSERT(global_context->IsGlobalContext());
ASSERT(native_context->IsNativeContext());
STATIC_ASSERT(kEntryLength == 3);
Object* value = shared->optimized_code_map();
Handle<FixedArray> new_code_map;
@ -7389,24 +7389,24 @@ void SharedFunctionInfo::AddToOptimizedCodeMap(
ASSERT_EQ(0, Smi::cast(value)->value());
// Crate 3 entries per context {context, code, literals}.
new_code_map = FACTORY->NewFixedArray(kEntryLength);
new_code_map->set(0, *global_context);
new_code_map->set(0, *native_context);
new_code_map->set(1, *code);
new_code_map->set(2, *literals);
} else {
// Copy old map and append one new entry.
Handle<FixedArray> old_code_map(FixedArray::cast(value));
ASSERT_EQ(-1, shared->SearchOptimizedCodeMap(*global_context));
ASSERT_EQ(-1, shared->SearchOptimizedCodeMap(*native_context));
int old_length = old_code_map->length();
int new_length = old_length + kEntryLength;
new_code_map = FACTORY->NewFixedArray(new_length);
old_code_map->CopyTo(0, *new_code_map, 0, old_length);
new_code_map->set(old_length, *global_context);
new_code_map->set(old_length, *native_context);
new_code_map->set(old_length + 1, *code);
new_code_map->set(old_length + 2, *literals);
}
#ifdef DEBUG
for (int i = 0; i < new_code_map->length(); i += kEntryLength) {
ASSERT(new_code_map->get(i)->IsGlobalContext());
ASSERT(new_code_map->get(i)->IsNativeContext());
ASSERT(new_code_map->get(i + 1)->IsCode());
ASSERT(Code::cast(new_code_map->get(i + 1))->kind() ==
Code::OPTIMIZED_FUNCTION);
@ -7429,7 +7429,7 @@ void SharedFunctionInfo::InstallFromOptimizedCodeMap(JSFunction* function,
}
Code* code = Code::cast(code_map->get(index));
ASSERT(code != NULL);
ASSERT(function->context()->global_context() == code_map->get(index - 1));
ASSERT(function->context()->native_context() == code_map->get(index - 1));
function->ReplaceCode(code);
}
@ -7547,7 +7547,7 @@ MaybeObject* JSFunction::SetPrototype(Object* value) {
new_map->set_constructor(value);
new_map->set_non_instance_prototype(true);
construct_prototype =
heap->isolate()->context()->global_context()->
heap->isolate()->context()->native_context()->
initial_object_prototype();
} else {
map()->set_non_instance_prototype(false);
@ -7558,10 +7558,10 @@ MaybeObject* JSFunction::SetPrototype(Object* value) {
Object* JSFunction::RemovePrototype() {
Context* global_context = context()->global_context();
Context* native_context = context()->native_context();
Map* no_prototype_map = shared()->is_classic_mode()
? global_context->function_without_prototype_map()
: global_context->strict_mode_function_without_prototype_map();
? native_context->function_without_prototype_map()
: native_context->strict_mode_function_without_prototype_map();
if (map() == no_prototype_map) {
// Be idempotent.
@ -7569,8 +7569,8 @@ Object* JSFunction::RemovePrototype() {
}
ASSERT(map() == (shared()->is_classic_mode()
? global_context->function_map()
: global_context->strict_mode_function_map()));
? native_context->function_map()
: native_context->strict_mode_function_map()));
set_map(no_prototype_map);
set_prototype_or_initial_map(no_prototype_map->GetHeap()->the_hole_value());
@ -7590,8 +7590,8 @@ void JSFunction::PrintName(FILE* out) {
}
Context* JSFunction::GlobalContextFromLiterals(FixedArray* literals) {
return Context::cast(literals->get(JSFunction::kLiteralGlobalContextIndex));
Context* JSFunction::NativeContextFromLiterals(FixedArray* literals) {
return Context::cast(literals->get(JSFunction::kLiteralNativeContextIndex));
}
@ -7989,15 +7989,15 @@ void SharedFunctionInfo::CompleteInobjectSlackTracking() {
}
int SharedFunctionInfo::SearchOptimizedCodeMap(Context* global_context) {
ASSERT(global_context->IsGlobalContext());
int SharedFunctionInfo::SearchOptimizedCodeMap(Context* native_context) {
ASSERT(native_context->IsNativeContext());
if (!FLAG_cache_optimized_code) return -1;
Object* value = optimized_code_map();
if (!value->IsSmi()) {
FixedArray* optimized_code_map = FixedArray::cast(value);
int length = optimized_code_map->length();
for (int i = 0; i < length; i += 3) {
if (optimized_code_map->get(i) == global_context) {
if (optimized_code_map->get(i) == native_context) {
return i + 1;
}
}

View File

@ -808,7 +808,7 @@ class MaybeObject BASE_EMBEDDED {
V(FixedArray) \
V(FixedDoubleArray) \
V(Context) \
V(GlobalContext) \
V(NativeContext) \
V(ModuleContext) \
V(ScopeInfo) \
V(JSFunction) \
@ -905,8 +905,8 @@ class Object : public MaybeObject {
Object* ToBoolean(); // ECMA-262 9.2.
// Convert to a JSObject if needed.
// global_context is used when creating wrapper object.
MUST_USE_RESULT MaybeObject* ToObject(Context* global_context);
// native_context is used when creating wrapper object.
MUST_USE_RESULT MaybeObject* ToObject(Context* native_context);
// Converts this to a Smi if possible.
// Failure is returned otherwise.
@ -5321,14 +5321,14 @@ class SharedFunctionInfo: public HeapObject {
// [code]: Function code.
DECL_ACCESSORS(code, Code)
// [optimized_code_map]: Map from global context to optimized code
// [optimized_code_map]: Map from native context to optimized code
// and a shared literals array or Smi 0 if none.
DECL_ACCESSORS(optimized_code_map, Object)
// Returns index i of the entry with the specified context. At position
// i - 1 is the context, position i the code, and i + 1 the literals array.
// Returns -1 when no matching entry is found.
int SearchOptimizedCodeMap(Context* global_context);
int SearchOptimizedCodeMap(Context* native_context);
// Installs optimized code from the code map on the given closure. The
// index has to be consistent with a search result as defined above.
@ -5339,7 +5339,7 @@ class SharedFunctionInfo: public HeapObject {
// Add a new entry to the optimized code map.
static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
Handle<Context> global_context,
Handle<Context> native_context,
Handle<Code> code,
Handle<FixedArray> literals);
static const int kEntryLength = 3;
@ -6122,8 +6122,8 @@ class JSFunction: public JSObject {
// Returns the number of allocated literals.
inline int NumberOfLiterals();
// Retrieve the global context from a function's literal array.
static Context* GlobalContextFromLiterals(FixedArray* literals);
// Retrieve the native context from a function's literal array.
static Context* NativeContextFromLiterals(FixedArray* literals);
// Layout descriptors. The last property (from kNonWeakFieldsEndOffset to
// kSize) is weak and has special handling during garbage collection.
@ -6140,7 +6140,7 @@ class JSFunction: public JSObject {
// Layout of the literals array.
static const int kLiteralsPrefixSize = 1;
static const int kLiteralGlobalContextIndex = 0;
static const int kLiteralNativeContextIndex = 0;
// Layout of the bound-function binding array.
static const int kBoundFunctionIndex = 0;
@ -6162,7 +6162,7 @@ class JSFunction: public JSObject {
class JSGlobalProxy : public JSObject {
public:
// [context]: the owner global context of this global proxy object.
// [context]: the owner native context of this global proxy object.
// It is null value if this object is not used by any context.
DECL_ACCESSORS(context, Object)
@ -6199,8 +6199,8 @@ class GlobalObject: public JSObject {
// [builtins]: the object holding the runtime routines written in JS.
DECL_ACCESSORS(builtins, JSBuiltinsObject)
// [global context]: the global context corresponding to this global object.
DECL_ACCESSORS(global_context, Context)
// [native context]: the natives corresponding to this global object.
DECL_ACCESSORS(native_context, Context)
// [global receiver]: the global receiver object of the context
DECL_ACCESSORS(global_receiver, JSObject)
@ -6230,8 +6230,8 @@ class GlobalObject: public JSObject {
// Layout description.
static const int kBuiltinsOffset = JSObject::kHeaderSize;
static const int kGlobalContextOffset = kBuiltinsOffset + kPointerSize;
static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize;
static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize;
static const int kGlobalReceiverOffset = kNativeContextOffset + kPointerSize;
static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize;
private:

View File

@ -1711,8 +1711,8 @@ HeapEntry* V8HeapExplorer::AddEntry(HeapObject* object) {
name->IsString()
? collection_->names()->GetName(String::cast(name))
: "");
} else if (object->IsGlobalContext()) {
return AddEntry(object, HeapEntry::kHidden, "system / GlobalContext");
} else if (object->IsNativeContext()) {
return AddEntry(object, HeapEntry::kHidden, "system / NativeContext");
} else if (object->IsContext()) {
return AddEntry(object, HeapEntry::kHidden, "system / Context");
} else if (object->IsFixedArray() ||
@ -1946,8 +1946,8 @@ void V8HeapExplorer::ExtractJSObjectReferences(
"builtins", global_obj->builtins(),
GlobalObject::kBuiltinsOffset);
SetInternalReference(global_obj, entry,
"global_context", global_obj->global_context(),
GlobalObject::kGlobalContextOffset);
"native_context", global_obj->native_context(),
GlobalObject::kNativeContextOffset);
SetInternalReference(global_obj, entry,
"global_receiver", global_obj->global_receiver(),
GlobalObject::kGlobalReceiverOffset);
@ -1983,16 +1983,16 @@ void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) {
EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous);
EXTRACT_CONTEXT_FIELD(EXTENSION_INDEX, Object, extension);
EXTRACT_CONTEXT_FIELD(GLOBAL_INDEX, GlobalObject, global);
if (context->IsGlobalContext()) {
if (context->IsNativeContext()) {
TagObject(context->jsfunction_result_caches(),
"(context func. result caches)");
TagObject(context->normalized_map_cache(), "(context norm. map cache)");
TagObject(context->runtime_context(), "(runtime context)");
TagObject(context->data(), "(context data)");
GLOBAL_CONTEXT_FIELDS(EXTRACT_CONTEXT_FIELD);
NATIVE_CONTEXT_FIELDS(EXTRACT_CONTEXT_FIELD);
#undef EXTRACT_CONTEXT_FIELD
for (int i = Context::FIRST_WEAK_SLOT;
i < Context::GLOBAL_CONTEXT_SLOTS;
i < Context::NATIVE_CONTEXT_SLOTS;
++i) {
SetWeakReference(context, entry, i, context->get(i),
FixedArray::OffsetOfElementAt(i));
@ -2672,7 +2672,7 @@ class GlobalObjectsEnumerator : public ObjectVisitor {
public:
virtual void VisitPointers(Object** start, Object** end) {
for (Object** p = start; p < end; p++) {
if ((*p)->IsGlobalContext()) {
if ((*p)->IsNativeContext()) {
Context* context = Context::cast(*p);
JSObject* proxy = context->global_proxy();
if (proxy->IsJSGlobalProxy()) {

View File

@ -303,7 +303,7 @@ static Handle<Map> ComputeObjectLiteralMap(
}
}
// If we only have symbols and array indices among keys then we can
// use the map cache in the global context.
// use the map cache in the native context.
const int kMaxKeys = 10;
if ((number_of_symbol_keys == number_of_properties) &&
(number_of_symbol_keys < kMaxKeys)) {
@ -342,14 +342,14 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
Handle<FixedArray> constant_properties,
bool should_have_fast_elements,
bool has_function_literal) {
// Get the global context from the literals array. This is the
// Get the native context from the literals array. This is the
// context in which the function was created and we use the object
// function from this context to create the object literal. We do
// not use the object function from the current global context
// not use the object function from the current native context
// because this might be the object function from another context
// which we should not have access to.
Handle<Context> context =
Handle<Context>(JSFunction::GlobalContextFromLiterals(*literals));
Handle<Context>(JSFunction::NativeContextFromLiterals(*literals));
// In case we have function literals, we want the object to be in
// slow properties mode for now. We don't go in the map cache because
@ -464,7 +464,7 @@ Handle<Object> Runtime::CreateArrayLiteralBoilerplate(
Handle<FixedArray> elements) {
// Create the JSArray.
Handle<JSFunction> constructor(
JSFunction::GlobalContextFromLiterals(*literals)->array_function());
JSFunction::NativeContextFromLiterals(*literals)->array_function());
Handle<JSArray> object =
Handle<JSArray>::cast(isolate->factory()->NewJSObject(constructor));
@ -474,8 +474,8 @@ Handle<Object> Runtime::CreateArrayLiteralBoilerplate(
FixedArrayBase::cast(elements->get(1)));
ASSERT(IsFastElementsKind(constant_elements_kind));
Context* global_context = isolate->context()->global_context();
Object* maybe_maps_array = global_context->js_array_maps();
Context* native_context = isolate->context()->native_context();
Object* maybe_maps_array = native_context->js_array_maps();
ASSERT(!maybe_maps_array->IsUndefined());
Object* maybe_map = FixedArray::cast(maybe_maps_array)->get(
constant_elements_kind);
@ -1446,7 +1446,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareContextSlot) {
HandleScope scope(isolate);
ASSERT(args.length() == 4);
// Declarations are always made in a function or global context. In the
// Declarations are always made in a function or native context. In the
// case of eval code, the context passed is the context of the caller,
// which may be some nested context and not the declaration context.
RUNTIME_ASSERT(args[0]->IsContext());
@ -1485,7 +1485,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareContextSlot) {
}
} else {
// Slow case: The property is in the context extension object of a
// function context or the global object of a global context.
// function context or the global object of a native context.
Handle<JSObject> object = Handle<JSObject>::cast(holder);
RETURN_IF_EMPTY_HANDLE(
isolate,
@ -1686,7 +1686,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstContextSlot) {
Handle<Object> value(args[0], isolate);
ASSERT(!value->IsTheHole());
// Initializations are always done in a function or global context.
// Initializations are always done in a function or native context.
RUNTIME_ASSERT(args[1]->IsContext());
Handle<Context> context(Context::cast(args[1])->declaration_context());
@ -1835,7 +1835,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpConstructResult) {
AssertNoAllocation no_gc;
HandleScope scope(isolate);
reinterpret_cast<HeapObject*>(new_object)->
set_map(isolate->global_context()->regexp_result_map());
set_map(isolate->native_context()->regexp_result_map());
}
JSArray* array = JSArray::cast(new_object);
array->set_properties(isolate->heap()->empty_fixed_array());
@ -1987,9 +1987,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultReceiver) {
// Returns undefined for strict or native functions, or
// the associated global receiver for "normal" functions.
Context* global_context =
function->context()->global()->global_context();
return global_context->global()->global_receiver();
Context* native_context =
function->context()->global()->native_context();
return native_context->global()->global_receiver();
}
@ -2004,11 +2004,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MaterializeRegExpLiteral) {
// Get the RegExp function from the context in the literals array.
// This is the RegExp function from the context in which the
// function was created. We do not use the RegExp function from the
// current global context because this might be the RegExp function
// current native context because this might be the RegExp function
// from another context which we should not have access to.
Handle<JSFunction> constructor =
Handle<JSFunction>(
JSFunction::GlobalContextFromLiterals(*literals)->regexp_function());
JSFunction::NativeContextFromLiterals(*literals)->regexp_function());
// Compute the regular expression literal.
bool has_pending_exception;
Handle<Object> regexp =
@ -2262,8 +2262,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCode) {
Handle<FixedArray> literals =
isolate->factory()->NewFixedArray(number_of_literals, TENURED);
if (number_of_literals > 0) {
literals->set(JSFunction::kLiteralGlobalContextIndex,
context->global_context());
literals->set(JSFunction::kLiteralNativeContextIndex,
context->native_context());
}
target->set_context(*context);
target->set_literals(*literals);
@ -8412,8 +8412,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_PushWithContext) {
if (args[1]->IsSmi()) {
// A smi sentinel indicates a context nested inside global code rather
// than some function. There is a canonical empty function that can be
// gotten from the global context.
function = isolate->context()->global_context()->closure();
// gotten from the native context.
function = isolate->context()->native_context()->closure();
} else {
function = JSFunction::cast(args[1]);
}
@ -8438,8 +8438,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_PushCatchContext) {
if (args[2]->IsSmi()) {
// A smi sentinel indicates a context nested inside global code rather
// than some function. There is a canonical empty function that can be
// gotten from the global context.
function = isolate->context()->global_context()->closure();
// gotten from the native context.
function = isolate->context()->native_context()->closure();
} else {
function = JSFunction::cast(args[2]);
}
@ -8463,8 +8463,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_PushBlockContext) {
if (args[1]->IsSmi()) {
// A smi sentinel indicates a context nested inside global code rather
// than some function. There is a canonical empty function that can be
// gotten from the global context.
function = isolate->context()->global_context()->closure();
// gotten from the native context.
function = isolate->context()->native_context()->closure();
} else {
function = JSFunction::cast(args[1]);
}
@ -8583,7 +8583,7 @@ static Object* ComputeReceiverForNonGlobal(Isolate* isolate,
Context* top = isolate->context();
// Get the context extension function.
JSFunction* context_extension_function =
top->global_context()->context_extension_function();
top->native_context()->context_extension_function();
// If the holder isn't a context extension object, we just return it
// as the receiver. This allows arguments objects to be used as
// receivers, but only if they are put in the context scope chain
@ -9045,10 +9045,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileString) {
ASSERT_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(String, source, 0);
// Extract global context.
Handle<Context> context(isolate->context()->global_context());
// Extract native context.
Handle<Context> context(isolate->context()->native_context());
// Check if global context allows code generation from
// Check if native context allows code generation from
// strings. Throw an exception if it doesn't.
if (context->allow_code_gen_from_strings()->IsFalse() &&
!CodeGenerationFromStringsAllowed(isolate, context)) {
@ -9056,7 +9056,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileString) {
"code_gen_from_strings", HandleVector<Object>(NULL, 0)));
}
// Compile source string in the global context.
// Compile source string in the native context.
Handle<SharedFunctionInfo> shared = Compiler::CompileEval(
source, context, true, CLASSIC_MODE, RelocInfo::kNoPosition);
if (shared.is_null()) return Failure::Exception();
@ -9074,12 +9074,12 @@ static ObjectPair CompileGlobalEval(Isolate* isolate,
LanguageMode language_mode,
int scope_position) {
Handle<Context> context = Handle<Context>(isolate->context());
Handle<Context> global_context = Handle<Context>(context->global_context());
Handle<Context> native_context = Handle<Context>(context->native_context());
// Check if global context allows code generation from
// Check if native context allows code generation from
// strings. Throw an exception if it doesn't.
if (global_context->allow_code_gen_from_strings()->IsFalse() &&
!CodeGenerationFromStringsAllowed(isolate, global_context)) {
if (native_context->allow_code_gen_from_strings()->IsFalse() &&
!CodeGenerationFromStringsAllowed(isolate, native_context)) {
isolate->Throw(*isolate->factory()->NewError(
"code_gen_from_strings", HandleVector<Object>(NULL, 0)));
return MakePair(Failure::Exception(), NULL);
@ -9090,7 +9090,7 @@ static ObjectPair CompileGlobalEval(Isolate* isolate,
Handle<SharedFunctionInfo> shared = Compiler::CompileEval(
source,
Handle<Context>(isolate->context()),
context->IsGlobalContext(),
context->IsNativeContext(),
language_mode,
scope_position);
if (shared.is_null()) return MakePair(Failure::Exception(), NULL);
@ -9112,7 +9112,7 @@ RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) {
// (And even if it is, but the first argument isn't a string, just let
// execution default to an indirect call to eval, which will also return
// the first argument without doing anything).
if (*callee != isolate->global_context()->global_eval_fun() ||
if (*callee != isolate->native_context()->global_eval_fun() ||
!args[1]->IsString()) {
return MakePair(*callee, isolate->heap()->the_hole_value());
}
@ -10017,7 +10017,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPropertyDetails) {
// entered (if the debugger is entered). The reason for switching context here
// is that for some property lookups (accessors and interceptors) callbacks
// into the embedding application can occour, and the embedding application
// could have the assumption that its own global context is the current
// could have the assumption that its own native context is the current
// context and not some internal debugger context.
SaveContext save(isolate);
if (isolate->debug()->InDebugger()) {
@ -10562,12 +10562,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) {
// value object is not converted into a wrapped JS objects. To
// hide this optimization from the debugger, we wrap the receiver
// by creating correct wrapper object based on the calling frame's
// global context.
// native context.
it.Advance();
Handle<Context> calling_frames_global_context(
Context::cast(Context::cast(it.frame()->context())->global_context()));
Handle<Context> calling_frames_native_context(
Context::cast(Context::cast(it.frame()->context())->native_context()));
receiver =
isolate->factory()->ToObject(receiver, calling_frames_global_context);
isolate->factory()->ToObject(receiver, calling_frames_native_context);
}
details->set(kFrameDetailsReceiverIndex, *receiver);
@ -10659,7 +10659,7 @@ static Handle<JSObject> MaterializeLocalScopeWithFrameInspector(
// These will be variables introduced by eval.
if (function_context->closure() == *function) {
if (function_context->has_extension() &&
!function_context->IsGlobalContext()) {
!function_context->IsNativeContext()) {
Handle<JSObject> ext(JSObject::cast(function_context->extension()));
bool threw = false;
Handle<FixedArray> keys =
@ -10921,7 +10921,7 @@ class ScopeIterator {
ScopeType scope_type = Type();
if (scope_type == ScopeTypeGlobal) {
// The global scope is always the last in the chain.
ASSERT(context_->IsGlobalContext());
ASSERT(context_->IsNativeContext());
context_ = Handle<Context>();
return;
}
@ -10949,7 +10949,7 @@ class ScopeIterator {
ASSERT(context_->IsModuleContext());
return ScopeTypeModule;
case GLOBAL_SCOPE:
ASSERT(context_->IsGlobalContext());
ASSERT(context_->IsNativeContext());
return ScopeTypeGlobal;
case WITH_SCOPE:
ASSERT(context_->IsWithContext());
@ -10965,7 +10965,7 @@ class ScopeIterator {
UNREACHABLE();
}
}
if (context_->IsGlobalContext()) {
if (context_->IsNativeContext()) {
ASSERT(context_->global()->IsGlobalObject());
return ScopeTypeGlobal;
}
@ -11854,7 +11854,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
Handle<SharedFunctionInfo> shared =
Compiler::CompileEval(function_source,
context,
context->IsGlobalContext(),
context->IsNativeContext(),
CLASSIC_MODE,
RelocInfo::kNoPosition);
if (shared.is_null()) return Failure::Exception();
@ -11925,9 +11925,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) {
isolate->set_context(*top->context());
}
// Get the global context now set to the top context from before the
// Get the native context now set to the top context from before the
// debugger was invoked.
Handle<Context> context = isolate->global_context();
Handle<Context> context = isolate->native_context();
bool is_global = true;
@ -12092,7 +12092,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugReferencedBy) {
// Get the constructor function for context extension and arguments array.
JSObject* arguments_boilerplate =
isolate->context()->global_context()->arguments_boilerplate();
isolate->context()->native_context()->arguments_boilerplate();
JSFunction* arguments_function =
JSFunction::cast(arguments_boilerplate->map()->constructor());
@ -12121,7 +12121,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugReferencedBy) {
// Return result as JS array.
Object* result;
MaybeObject* maybe_result = isolate->heap()->AllocateJSObject(
isolate->context()->global_context()->array_function());
isolate->context()->native_context()->array_function());
if (!maybe_result->ToObject(&result)) return maybe_result;
return JSArray::cast(result)->SetContent(instances);
}
@ -12202,7 +12202,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugConstructedBy) {
// Return result as JS array.
Object* result;
{ MaybeObject* maybe_result = isolate->heap()->AllocateJSObject(
isolate->context()->global_context()->array_function());
isolate->context()->native_context()->array_function());
if (!maybe_result->ToObject(&result)) return maybe_result;
}
return JSArray::cast(result)->SetContent(instances);
@ -13076,7 +13076,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFromCache) {
Handle<JSFunction> factory(JSFunction::cast(
cache_handle->get(JSFunctionResultCache::kFactoryIndex)));
// TODO(antonm): consider passing a receiver when constructing a cache.
Handle<Object> receiver(isolate->global_context()->global());
Handle<Object> receiver(isolate->native_context()->global());
// This handle is nor shared, nor used later, so it's safe.
Handle<Object> argv[] = { key_handle };
bool pending_exception;

View File

@ -215,7 +215,7 @@ Scope* Scope::DeserializeScopeChain(Context* context, Scope* global_scope,
Scope* current_scope = NULL;
Scope* innermost_scope = NULL;
bool contains_with = false;
while (!context->IsGlobalContext()) {
while (!context->IsNativeContext()) {
if (context->IsWithContext()) {
Scope* with_scope = new(zone) Scope(current_scope,
WITH_SCOPE,

View File

@ -378,7 +378,7 @@ class Scope: public ZoneObject {
// Determine if we can use lazy compilation for this scope without a context.
bool AllowsLazyCompilationWithoutContext() const;
// True if the outer context of this scope is always the global context.
// True if the outer context of this scope is always the native context.
bool HasTrivialOuterContext() const;
// True if the outer context allows lazy compilation of this scope.

View File

@ -692,7 +692,7 @@ void Deserializer::Deserialize() {
isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG);
isolate_->heap()->IterateWeakRoots(this, VISIT_ALL);
isolate_->heap()->set_global_contexts_list(
isolate_->heap()->set_native_contexts_list(
isolate_->heap()->undefined_value());
// Update data pointers to the external strings containing natives sources.

View File

@ -469,7 +469,7 @@ void StringStream::PrintSecurityTokenIfChanged(Object* f) {
Add("(Function context is outside heap)\n");
return;
}
Object* token = context->global_context()->security_token();
Object* token = context->native_context()->security_token();
if (token != isolate->string_stream_current_security_token()) {
Add("Security context: %o\n", token);
isolate->set_string_stream_current_security_token(token);

View File

@ -936,7 +936,7 @@ void StubCache::Clear() {
void StubCache::CollectMatchingMaps(SmallMapList* types,
String* name,
Code::Flags flags,
Handle<Context> global_context,
Handle<Context> native_context,
Zone* zone) {
for (int i = 0; i < kPrimaryTableSize; i++) {
if (primary_[i].key == name) {
@ -947,7 +947,7 @@ void StubCache::CollectMatchingMaps(SmallMapList* types,
int offset = PrimaryOffset(name, flags, map);
if (entry(primary_, offset) == &primary_[i] &&
!TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) {
!TypeFeedbackOracle::CanRetainOtherContext(map, *native_context)) {
types->Add(Handle<Map>(map), zone);
}
}
@ -971,7 +971,7 @@ void StubCache::CollectMatchingMaps(SmallMapList* types,
// Lookup in secondary table and add matches.
int offset = SecondaryOffset(name, flags, primary_offset);
if (entry(secondary_, offset) == &secondary_[i] &&
!TypeFeedbackOracle::CanRetainOtherContext(map, *global_context)) {
!TypeFeedbackOracle::CanRetainOtherContext(map, *native_context)) {
types->Add(Handle<Map>(map), zone);
}
}

View File

@ -261,7 +261,7 @@ class StubCache {
void CollectMatchingMaps(SmallMapList* types,
String* name,
Code::Flags flags,
Handle<Context> global_context,
Handle<Context> native_context,
Zone* zone);
// Generate code for probing the stub cache table.

View File

@ -60,10 +60,10 @@ TypeInfo TypeInfo::TypeFromValue(Handle<Object> value) {
TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code,
Handle<Context> global_context,
Handle<Context> native_context,
Isolate* isolate,
Zone* zone) {
global_context_ = global_context;
native_context_ = native_context;
isolate_ = isolate;
zone_ = zone;
BuildDictionary(code);
@ -105,7 +105,7 @@ bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) {
Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL;
if (!preliminary_checks) return false;
Map* map = code->FindFirstMap();
return map != NULL && !CanRetainOtherContext(map, *global_context_);
return map != NULL && !CanRetainOtherContext(map, *native_context_);
}
return false;
}
@ -139,7 +139,7 @@ bool TypeFeedbackOracle::StoreIsMonomorphicNormal(TypeFeedbackId ast_id) {
Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL;
if (!preliminary_checks) return false;
Map* map = code->FindFirstMap();
return map != NULL && !CanRetainOtherContext(map, *global_context_);
return map != NULL && !CanRetainOtherContext(map, *native_context_);
}
return false;
}
@ -196,7 +196,7 @@ Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) {
Handle<Code> code = Handle<Code>::cast(map_or_code);
Map* first_map = code->FindFirstMap();
ASSERT(first_map != NULL);
return CanRetainOtherContext(first_map, *global_context_)
return CanRetainOtherContext(first_map, *native_context_)
? Handle<Map>::null()
: Handle<Map>(first_map);
}
@ -212,7 +212,7 @@ Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(
Handle<Code> code = Handle<Code>::cast(map_or_code);
Map* first_map = code->FindFirstMap();
ASSERT(first_map != NULL);
return CanRetainOtherContext(first_map, *global_context_)
return CanRetainOtherContext(first_map, *native_context_)
? Handle<Map>::null()
: Handle<Map>(first_map);
}
@ -275,13 +275,13 @@ Handle<JSObject> TypeFeedbackOracle::GetPrototypeForPrimitiveCheck(
UNREACHABLE();
break;
case STRING_CHECK:
function = global_context_->string_function();
function = native_context_->string_function();
break;
case NUMBER_CHECK:
function = global_context_->number_function();
function = native_context_->number_function();
break;
case BOOLEAN_CHECK:
function = global_context_->boolean_function();
function = native_context_->boolean_function();
break;
}
ASSERT(function != NULL);
@ -363,7 +363,7 @@ Handle<Map> TypeFeedbackOracle::GetCompareMap(CompareOperation* expr) {
}
Map* first_map = code->FindFirstMap();
ASSERT(first_map != NULL);
return CanRetainOtherContext(first_map, *global_context_)
return CanRetainOtherContext(first_map, *native_context_)
? Handle<Map>::null()
: Handle<Map>(first_map);
}
@ -522,27 +522,27 @@ void TypeFeedbackOracle::CollectReceiverTypes(TypeFeedbackId ast_id,
isolate_->stub_cache()->CollectMatchingMaps(types,
*name,
flags,
global_context_,
native_context_,
zone());
}
}
// Check if a map originates from a given global context. We use this
// Check if a map originates from a given native context. We use this
// information to filter out maps from different context to avoid
// retaining objects from different tabs in Chrome via optimized code.
bool TypeFeedbackOracle::CanRetainOtherContext(Map* map,
Context* global_context) {
Context* native_context) {
Object* constructor = NULL;
while (!map->prototype()->IsNull()) {
constructor = map->constructor();
if (!constructor->IsNull()) {
// If the constructor is not null or a JSFunction, we have to
// conservatively assume that it may retain a global context.
// conservatively assume that it may retain a native context.
if (!constructor->IsJSFunction()) return true;
// Check if the constructor directly references a foreign context.
if (CanRetainOtherContext(JSFunction::cast(constructor),
global_context)) {
native_context)) {
return true;
}
}
@ -551,14 +551,14 @@ bool TypeFeedbackOracle::CanRetainOtherContext(Map* map,
constructor = map->constructor();
if (constructor->IsNull()) return false;
JSFunction* function = JSFunction::cast(constructor);
return CanRetainOtherContext(function, global_context);
return CanRetainOtherContext(function, native_context);
}
bool TypeFeedbackOracle::CanRetainOtherContext(JSFunction* function,
Context* global_context) {
return function->context()->global() != global_context->global()
&& function->context()->global() != global_context->builtins();
Context* native_context) {
return function->context()->global() != native_context->global()
&& function->context()->global() != native_context->builtins();
}
@ -585,7 +585,7 @@ void TypeFeedbackOracle::CollectKeyedReceiverTypes(TypeFeedbackId ast_id,
Object* object = info->target_object();
if (object->IsMap()) {
Map* map = Map::cast(object);
if (!CanRetainOtherContext(map, *global_context_)) {
if (!CanRetainOtherContext(map, *native_context_)) {
AddMapIfMissing(Handle<Map>(map), types, zone());
}
}
@ -672,7 +672,7 @@ void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) {
if (map == NULL) {
SetInfo(ast_id, static_cast<Object*>(target));
} else if (!CanRetainOtherContext(Map::cast(map),
*global_context_)) {
*native_context_)) {
SetInfo(ast_id, map);
}
}
@ -714,7 +714,7 @@ void TypeFeedbackOracle::ProcessTypeFeedbackCells(Handle<Code> code) {
if (value->IsSmi() ||
(value->IsJSFunction() &&
!CanRetainOtherContext(JSFunction::cast(value),
*global_context_))) {
*native_context_))) {
SetInfo(ast_id, value);
}
}

View File

@ -235,7 +235,7 @@ class ForInStatement;
class TypeFeedbackOracle: public ZoneObject {
public:
TypeFeedbackOracle(Handle<Code> code,
Handle<Context> global_context,
Handle<Context> native_context,
Isolate* isolate,
Zone* zone);
@ -266,9 +266,9 @@ class TypeFeedbackOracle: public ZoneObject {
void CollectKeyedReceiverTypes(TypeFeedbackId ast_id,
SmallMapList* types);
static bool CanRetainOtherContext(Map* map, Context* global_context);
static bool CanRetainOtherContext(Map* map, Context* native_context);
static bool CanRetainOtherContext(JSFunction* function,
Context* global_context);
Context* native_context);
CheckType GetCallCheckType(Call* expr);
Handle<JSObject> GetPrototypeForPrimitiveCheck(CheckType check);
@ -317,7 +317,7 @@ class TypeFeedbackOracle: public ZoneObject {
// there is no information.
Handle<Object> GetInfo(TypeFeedbackId ast_id);
Handle<Context> global_context_;
Handle<Context> native_context_;
Isolate* isolate_;
Handle<UnseededNumberDictionary> dictionary_;
Zone* zone_;

View File

@ -169,7 +169,7 @@ void V8::SetReturnAddressLocationResolver(
// Used by JavaScript APIs
uint32_t V8::Random(Context* context) {
ASSERT(context->IsGlobalContext());
ASSERT(context->IsNativeContext());
ByteArray* seed = context->random_seed();
return random_base(reinterpret_cast<uint32_t*>(seed->GetDataStartAddress()));
}

View File

@ -752,7 +752,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
const int kGlobalIndex =
Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
__ movq(rbx, FieldOperand(rsi, kGlobalIndex));
__ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalContextOffset));
__ movq(rbx, FieldOperand(rbx, GlobalObject::kNativeContextOffset));
__ movq(rbx, FieldOperand(rbx, kGlobalIndex));
__ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset));
@ -937,7 +937,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
const int kGlobalOffset =
Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
__ movq(rbx, FieldOperand(rsi, kGlobalOffset));
__ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalContextOffset));
__ movq(rbx, FieldOperand(rbx, GlobalObject::kNativeContextOffset));
__ movq(rbx, FieldOperand(rbx, kGlobalOffset));
__ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset));

View File

@ -76,10 +76,10 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
? Context::FUNCTION_MAP_INDEX
: Context::STRICT_MODE_FUNCTION_MAP_INDEX;
// Compute the function map in the current global context and set that
// Compute the function map in the current native context and set that
// as the map of the allocated object.
__ movq(rcx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset));
__ movq(rcx, FieldOperand(rcx, GlobalObject::kNativeContextOffset));
__ movq(rbx, Operand(rcx, Context::SlotOffset(map_index)));
__ movq(FieldOperand(rax, JSObject::kMapOffset), rbx);
@ -120,8 +120,8 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
__ IncrementCounter(counters->fast_new_closure_try_optimized(), 1);
// rcx holds global context, ebx points to fixed array of 3-element entries
// (global context, optimized code, literals).
// rcx holds native context, ebx points to fixed array of 3-element entries
// (native context, optimized code, literals).
// The optimized code map must never be empty, so check the first elements.
Label install_optimized;
// Speculatively move code object into edx.
@ -259,9 +259,9 @@ void FastNewBlockContextStub::Generate(MacroAssembler* masm) {
__ movq(FieldOperand(rax, HeapObject::kMapOffset), kScratchRegister);
__ Move(FieldOperand(rax, FixedArray::kLengthOffset), Smi::FromInt(length));
// If this block context is nested in the global context we get a smi
// If this block context is nested in the native context we get a smi
// sentinel instead of a function. The block context should get the
// canonical empty function of the global context as its closure which
// canonical empty function of the native context as its closure which
// we still have to look up.
Label after_sentinel;
__ JumpIfNotSmi(rcx, &after_sentinel, Label::kNear);
@ -271,7 +271,7 @@ void FastNewBlockContextStub::Generate(MacroAssembler* masm) {
__ Assert(equal, message);
}
__ movq(rcx, GlobalObjectOperand());
__ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset));
__ movq(rcx, FieldOperand(rcx, GlobalObject::kNativeContextOffset));
__ movq(rcx, ContextOperand(rcx, Context::CLOSURE_INDEX));
__ bind(&after_sentinel);
@ -2459,7 +2459,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
// Get the arguments boilerplate from the current (global) context into rdi.
Label has_mapped_parameters, copy;
__ movq(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ movq(rdi, FieldOperand(rdi, GlobalObject::kGlobalContextOffset));
__ movq(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset));
__ testq(rbx, rbx);
__ j(not_zero, &has_mapped_parameters, Label::kNear);
@ -2674,7 +2674,7 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
// Get the arguments boilerplate from the current (global) context.
__ movq(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ movq(rdi, FieldOperand(rdi, GlobalObject::kGlobalContextOffset));
__ movq(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset));
const int offset =
Context::SlotOffset(Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX);
__ movq(rdi, Operand(rdi, offset));
@ -3204,7 +3204,7 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) {
// Set JSArray map to global.regexp_result_map().
__ movq(rdx, ContextOperand(rsi, Context::GLOBAL_INDEX));
__ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalContextOffset));
__ movq(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset));
__ movq(rdx, ContextOperand(rdx, Context::REGEXP_RESULT_MAP_INDEX));
__ movq(FieldOperand(rax, HeapObject::kMapOffset), rdx);

View File

@ -106,7 +106,7 @@ void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
// Iterate over all the functions which share the same code object
// and make them use unoptimized version.
Context* context = function->context()->global_context();
Context* context = function->context()->native_context();
Object* element = context->get(Context::OPTIMIZED_FUNCTIONS_LIST);
SharedFunctionInfo* shared = function->shared();
while (!element->IsUndefined()) {

View File

@ -1285,9 +1285,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
__ movq(temp, context);
}
// Load map for comparison into register, outside loop.
__ LoadRoot(kScratchRegister, Heap::kGlobalContextMapRootIndex);
__ LoadRoot(kScratchRegister, Heap::kNativeContextMapRootIndex);
__ bind(&next);
// Terminate at global context.
// Terminate at native context.
__ cmpq(kScratchRegister, FieldOperand(temp, HeapObject::kMapOffset));
__ j(equal, &fast, Label::kNear);
// Check that extension is NULL.
@ -2668,7 +2668,7 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
__ j(zero, if_false);
__ movq(rcx, FieldOperand(rcx, HeapObject::kMapOffset));
__ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
__ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalContextOffset));
__ movq(rdx, FieldOperand(rdx, GlobalObject::kNativeContextOffset));
__ cmpq(rcx,
ContextOperand(rdx, Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX));
__ j(not_equal, if_false);
@ -2946,11 +2946,11 @@ void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) {
__ PrepareCallCFunction(1);
#ifdef _WIN64
__ movq(rcx, ContextOperand(context_register(), Context::GLOBAL_INDEX));
__ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset));
__ movq(rcx, FieldOperand(rcx, GlobalObject::kNativeContextOffset));
#else
__ movq(rdi, ContextOperand(context_register(), Context::GLOBAL_INDEX));
__ movq(rdi, FieldOperand(rdi, GlobalObject::kGlobalContextOffset));
__ movq(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset));
#endif
__ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
@ -3367,7 +3367,7 @@ void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
int cache_id = Smi::cast(*(args->at(0)->AsLiteral()->handle()))->value();
Handle<FixedArray> jsfunction_result_caches(
isolate()->global_context()->jsfunction_result_caches());
isolate()->native_context()->jsfunction_result_caches());
if (jsfunction_result_caches->length() <= cache_id) {
__ Abort("Attempt to use undefined cache.");
__ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
@ -3382,7 +3382,7 @@ void FullCodeGenerator::EmitGetFromCache(CallRuntime* expr) {
Register tmp = rcx;
__ movq(cache, ContextOperand(rsi, Context::GLOBAL_INDEX));
__ movq(cache,
FieldOperand(cache, GlobalObject::kGlobalContextOffset));
FieldOperand(cache, GlobalObject::kNativeContextOffset));
__ movq(cache,
ContextOperand(cache, Context::JSFUNCTION_RESULT_CACHES_INDEX));
__ movq(cache,
@ -4429,7 +4429,7 @@ void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
Scope* declaration_scope = scope()->DeclarationScope();
if (declaration_scope->is_global_scope() ||
declaration_scope->is_module_scope()) {
// Contexts nested in the global context have a canonical empty function
// Contexts nested in the native context have a canonical empty function
// as their closure, not the anonymous closure containing the global
// code. Pass a smi sentinel and let the runtime look up the empty
// function.

View File

@ -3324,11 +3324,11 @@ void LCodeGen::DoRandom(LRandom* instr) {
STATIC_ASSERT(kPointerSize == 2 * kSeedSize);
__ movq(global_object,
FieldOperand(global_object, GlobalObject::kGlobalContextOffset));
FieldOperand(global_object, GlobalObject::kNativeContextOffset));
static const int kRandomSeedOffset =
FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize;
__ movq(rbx, FieldOperand(global_object, kRandomSeedOffset));
// rbx: FixedArray of the global context's random seeds
// rbx: FixedArray of the native context's random seeds
// Load state[0].
__ movl(rax, FieldOperand(rbx, ByteArray::kHeaderSize));

View File

@ -3442,16 +3442,16 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
cmpq(scratch, Immediate(0));
Check(not_equal, "we should not have an empty lexical context");
}
// Load the global context of the current context.
// Load the native context of the current context.
int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
movq(scratch, FieldOperand(scratch, offset));
movq(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset));
movq(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset));
// Check the context is a global context.
// Check the context is a native context.
if (emit_debug_code()) {
Cmp(FieldOperand(scratch, HeapObject::kMapOffset),
isolate()->factory()->global_context_map());
Check(equal, "JSGlobalObject::global_context should be a global context.");
isolate()->factory()->native_context_map());
Check(equal, "JSGlobalObject::native_context should be a native context.");
}
// Check if both contexts are the same.
@ -3463,7 +3463,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
// compatible with the security token in the receiving global
// object.
// Check the context is a global context.
// Check the context is a native context.
if (emit_debug_code()) {
// Preserve original value of holder_reg.
push(holder_reg);
@ -3471,10 +3471,10 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
CompareRoot(holder_reg, Heap::kNullValueRootIndex);
Check(not_equal, "JSGlobalProxy::context() should not be null.");
// Read the first word and compare to global_context_map(),
// Read the first word and compare to native_context_map(),
movq(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset));
CompareRoot(holder_reg, Heap::kGlobalContextMapRootIndex);
Check(equal, "JSGlobalObject::global_context should be a global context.");
CompareRoot(holder_reg, Heap::kNativeContextMapRootIndex);
Check(equal, "JSGlobalObject::native_context should be a native context.");
pop(holder_reg);
}
@ -4100,7 +4100,7 @@ void MacroAssembler::LoadTransitionedArrayMapConditional(
Label* no_map_match) {
// Load the global or builtins object from the current context.
movq(scratch, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
movq(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset));
movq(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset));
// Check that the function's map is the same as the expected cached map.
movq(scratch, Operand(scratch,
@ -4151,9 +4151,9 @@ static const int kRegisterPassedArguments = 6;
void MacroAssembler::LoadGlobalFunction(int index, Register function) {
// Load the global or builtins object from the current context.
movq(function, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
// Load the global context from the global or builtins object.
movq(function, FieldOperand(function, GlobalObject::kGlobalContextOffset));
// Load the function from the global context.
// Load the native context from the global or builtins object.
movq(function, FieldOperand(function, GlobalObject::kNativeContextOffset));
// Load the function from the native context.
movq(function, Operand(function, Context::SlotOffset(index)));
}

View File

@ -1133,8 +1133,8 @@ class MacroAssembler: public Assembler {
void LoadContext(Register dst, int context_chain_length);
// Conditionally load the cached Array transitioned map of type
// transitioned_kind from the global context if the map in register
// map_in_out is the cached Array map in the global context of
// transitioned_kind from the native context if the map in register
// map_in_out is the cached Array map in the native context of
// expected_kind.
void LoadTransitionedArrayMapConditional(
ElementsKind expected_kind,

View File

@ -229,10 +229,10 @@ void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm,
// Load the global or builtins object from the current context.
__ movq(prototype,
Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
// Load the global context from the global or builtins object.
// Load the native context from the global or builtins object.
__ movq(prototype,
FieldOperand(prototype, GlobalObject::kGlobalContextOffset));
// Load the function from the global context.
FieldOperand(prototype, GlobalObject::kNativeContextOffset));
// Load the function from the native context.
__ movq(prototype, Operand(prototype, Context::SlotOffset(index)));
// Load the initial map. The global functions all have initial maps.
__ movq(prototype,
@ -255,7 +255,7 @@ void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
__ j(not_equal, miss);
// Get the global function with the given index.
Handle<JSFunction> function(
JSFunction::cast(isolate->global_context()->get(index)));
JSFunction::cast(isolate->native_context()->get(index)));
// Load its initial map. The global functions all have initial maps.
__ Move(prototype, Handle<Map>(function->initial_map()));
// Load the prototype from the initial map.

View File

@ -12200,7 +12200,7 @@ class RegExpStringModificationTest {
// Inject the input as a global variable.
i::Handle<i::String> input_name =
FACTORY->NewStringFromAscii(i::Vector<const char>("input", 5));
i::Isolate::Current()->global_context()->global()->SetProperty(
i::Isolate::Current()->native_context()->global()->SetProperty(
*input_name,
*input_,
NONE,

View File

@ -125,7 +125,7 @@ static Handle<JSFunction> Compile(const char* source) {
Handle<String>::null(),
NOT_NATIVES_CODE);
return FACTORY->NewFunctionFromSharedFunctionInfo(shared_function,
Isolate::Current()->global_context());
Isolate::Current()->native_context());
}

View File

@ -7394,7 +7394,7 @@ TEST(Regress131642) {
// Import from test-heap.cc
int CountGlobalContexts();
int CountNativeContexts();
static void NopListener(v8::DebugEvent event,
@ -7407,15 +7407,15 @@ static void NopListener(v8::DebugEvent event,
TEST(DebuggerCreatesContextIffActive) {
v8::HandleScope scope;
DebugLocalContext env;
CHECK_EQ(1, CountGlobalContexts());
CHECK_EQ(1, CountNativeContexts());
v8::Debug::SetDebugEventListener(NULL);
CompileRun("debugger;");
CHECK_EQ(1, CountGlobalContexts());
CHECK_EQ(1, CountNativeContexts());
v8::Debug::SetDebugEventListener(NopListener);
CompileRun("debugger;");
CHECK_EQ(2, CountGlobalContexts());
CHECK_EQ(2, CountNativeContexts());
v8::Debug::SetDebugEventListener(NULL);
}

View File

@ -1521,7 +1521,7 @@ TEST(WeakGlobalHandle) {
}
TEST(WeakGlobalContextRefs) {
TEST(WeakNativeContextRefs) {
v8::HandleScope scope;
LocalContext env;
@ -1533,10 +1533,10 @@ TEST(WeakGlobalContextRefs) {
const v8::HeapGraphNode* global_handles = GetNode(
gc_roots, v8::HeapGraphNode::kObject, "(Global handles)");
CHECK_NE(NULL, global_handles);
const v8::HeapGraphNode* global_context = GetNode(
global_handles, v8::HeapGraphNode::kHidden, "system / GlobalContext");
CHECK_NE(NULL, global_context);
CHECK(HasWeakEdge(global_context));
const v8::HeapGraphNode* native_context = GetNode(
global_handles, v8::HeapGraphNode::kHidden, "system / NativeContext");
CHECK_NE(NULL, native_context);
CHECK(HasWeakEdge(native_context));
}

View File

@ -876,7 +876,7 @@ TEST(Regression39128) {
// Step 1: prepare a map for the object. We add 1 inobject property to it.
Handle<JSFunction> object_ctor(
Isolate::Current()->global_context()->object_function());
Isolate::Current()->native_context()->object_function());
CHECK(object_ctor->has_initial_map());
Handle<Map> object_map(object_ctor->initial_map());
// Create a map with single inobject property.
@ -985,10 +985,10 @@ TEST(TestCodeFlushing) {
}
// Count the number of global contexts in the weak list of global contexts.
int CountGlobalContexts() {
// Count the number of native contexts in the weak list of native contexts.
int CountNativeContexts() {
int count = 0;
Object* object = HEAP->global_contexts_list();
Object* object = HEAP->native_contexts_list();
while (!object->IsUndefined()) {
count++;
object = Context::cast(object)->get(Context::NEXT_CONTEXT_LINK);
@ -998,7 +998,7 @@ int CountGlobalContexts() {
// Count the number of user functions in the weak list of optimized
// functions attached to a global context.
// functions attached to a native context.
static int CountOptimizedUserFunctions(v8::Handle<v8::Context> context) {
int count = 0;
Handle<Context> icontext = v8::Utils::OpenHandle(*context);
@ -1019,7 +1019,7 @@ TEST(TestInternalWeakLists) {
v8::HandleScope scope;
v8::Persistent<v8::Context> ctx[kNumTestContexts];
CHECK_EQ(0, CountGlobalContexts());
CHECK_EQ(0, CountNativeContexts());
// Create a number of global contests which gets linked together.
for (int i = 0; i < kNumTestContexts; i++) {
@ -1027,7 +1027,7 @@ TEST(TestInternalWeakLists) {
bool opt = (FLAG_always_opt && i::V8::UseCrankshaft());
CHECK_EQ(i + 1, CountGlobalContexts());
CHECK_EQ(i + 1, CountNativeContexts());
ctx[i]->Enter();
@ -1087,7 +1087,7 @@ TEST(TestInternalWeakLists) {
// Force compilation cache cleanup.
HEAP->CollectAllGarbage(Heap::kNoGCFlags);
// Dispose the global contexts one by one.
// Dispose the native contexts one by one.
for (int i = 0; i < kNumTestContexts; i++) {
ctx[i].Dispose();
ctx[i].Clear();
@ -1095,23 +1095,23 @@ TEST(TestInternalWeakLists) {
// Scavenge treats these references as strong.
for (int j = 0; j < 10; j++) {
HEAP->PerformScavenge();
CHECK_EQ(kNumTestContexts - i, CountGlobalContexts());
CHECK_EQ(kNumTestContexts - i, CountNativeContexts());
}
// Mark compact handles the weak references.
HEAP->CollectAllGarbage(Heap::kNoGCFlags);
CHECK_EQ(kNumTestContexts - i - 1, CountGlobalContexts());
CHECK_EQ(kNumTestContexts - i - 1, CountNativeContexts());
}
CHECK_EQ(0, CountGlobalContexts());
CHECK_EQ(0, CountNativeContexts());
}
// Count the number of global contexts in the weak list of global contexts
// Count the number of native contexts in the weak list of native contexts
// causing a GC after the specified number of elements.
static int CountGlobalContextsWithGC(int n) {
static int CountNativeContextsWithGC(int n) {
int count = 0;
Handle<Object> object(HEAP->global_contexts_list());
Handle<Object> object(HEAP->native_contexts_list());
while (!object->IsUndefined()) {
count++;
if (count == n) HEAP->CollectAllGarbage(Heap::kNoGCFlags);
@ -1123,7 +1123,7 @@ static int CountGlobalContextsWithGC(int n) {
// Count the number of user functions in the weak list of optimized
// functions attached to a global context causing a GC after the
// functions attached to a native context causing a GC after the
// specified number of elements.
static int CountOptimizedUserFunctionsWithGC(v8::Handle<v8::Context> context,
int n) {
@ -1149,14 +1149,14 @@ TEST(TestInternalWeakListsTraverseWithGC) {
v8::HandleScope scope;
v8::Persistent<v8::Context> ctx[kNumTestContexts];
CHECK_EQ(0, CountGlobalContexts());
CHECK_EQ(0, CountNativeContexts());
// Create an number of contexts and check the length of the weak list both
// with and without GCs while iterating the list.
for (int i = 0; i < kNumTestContexts; i++) {
ctx[i] = v8::Context::New();
CHECK_EQ(i + 1, CountGlobalContexts());
CHECK_EQ(i + 1, CountGlobalContextsWithGC(i / 2 + 1));
CHECK_EQ(i + 1, CountNativeContexts());
CHECK_EQ(i + 1, CountNativeContextsWithGC(i / 2 + 1));
}
bool opt = (FLAG_always_opt && i::V8::UseCrankshaft());
@ -1366,7 +1366,7 @@ static int NumberOfGlobalObjects() {
// Test that we don't embed maps from foreign contexts into
// optimized code.
TEST(LeakGlobalContextViaMap) {
TEST(LeakNativeContextViaMap) {
i::FLAG_allow_natives_syntax = true;
v8::HandleScope outer_scope;
v8::Persistent<v8::Context> ctx1 = v8::Context::New();
@ -1403,7 +1403,7 @@ TEST(LeakGlobalContextViaMap) {
// Test that we don't embed functions from foreign contexts into
// optimized code.
TEST(LeakGlobalContextViaFunction) {
TEST(LeakNativeContextViaFunction) {
i::FLAG_allow_natives_syntax = true;
v8::HandleScope outer_scope;
v8::Persistent<v8::Context> ctx1 = v8::Context::New();
@ -1438,7 +1438,7 @@ TEST(LeakGlobalContextViaFunction) {
}
TEST(LeakGlobalContextViaMapKeyed) {
TEST(LeakNativeContextViaMapKeyed) {
i::FLAG_allow_natives_syntax = true;
v8::HandleScope outer_scope;
v8::Persistent<v8::Context> ctx1 = v8::Context::New();
@ -1473,7 +1473,7 @@ TEST(LeakGlobalContextViaMapKeyed) {
}
TEST(LeakGlobalContextViaMapProto) {
TEST(LeakNativeContextViaMapProto) {
i::FLAG_allow_natives_syntax = true;
v8::HandleScope outer_scope;
v8::Persistent<v8::Context> ctx1 = v8::Context::New();
@ -2040,7 +2040,7 @@ TEST(IncrementalMarkingClearsTypeFeedbackCells) {
}
// Prepare function f that contains type feedback for closures
// originating from two different global contexts.
// originating from two different native contexts.
v8::Context::GetCurrent()->Global()->Set(v8_str("fun1"), fun1);
v8::Context::GetCurrent()->Global()->Set(v8_str("fun2"), fun2);
CompileRun("function f(a, b) { a(); b(); } f(fun1, fun2);");
@ -2086,7 +2086,7 @@ TEST(IncrementalMarkingPreservesMonomorhpicIC) {
v8::HandleScope scope;
// Prepare function f that contains a monomorphic IC for object
// originating from the same global context.
// originating from the same native context.
CompileRun("function fun() { this.x = 1; }; var obj = new fun();"
"function f(o) { return o.x; } f(obj); f(obj);");
Handle<JSFunction> f =
@ -2120,7 +2120,7 @@ TEST(IncrementalMarkingClearsMonomorhpicIC) {
}
// Prepare function f that contains a monomorphic IC for object
// originating from a different global context.
// originating from a different native context.
v8::Context::GetCurrent()->Global()->Set(v8_str("obj1"), obj1);
CompileRun("function f(o) { return o.x; } f(obj1); f(obj1);");
Handle<JSFunction> f =
@ -2160,7 +2160,7 @@ TEST(IncrementalMarkingClearsPolymorhpicIC) {
}
// Prepare function f that contains a polymorphic IC for objects
// originating from two different global contexts.
// originating from two different native contexts.
v8::Context::GetCurrent()->Global()->Set(v8_str("obj1"), obj1);
v8::Context::GetCurrent()->Global()->Set(v8_str("obj2"), obj2);
CompileRun("function f(o) { return o.x; } f(obj1); f(obj1); f(obj2);");

View File

@ -283,7 +283,7 @@ static void SanityCheck() {
HEAP->Verify();
#endif
CHECK(Isolate::Current()->global()->IsJSObject());
CHECK(Isolate::Current()->global_context()->IsContext());
CHECK(Isolate::Current()->native_context()->IsContext());
CHECK(HEAP->symbol_table()->IsSymbolTable());
CHECK(!FACTORY->LookupAsciiSymbol("Empty")->IsFailure());
}