From 55e6227817f0c98ce1b1c0a67aaf853b6edb9088 Mon Sep 17 00:00:00 2001 From: "rossberg@chromium.org" Date: Mon, 20 Aug 2012 11:35:50 +0000 Subject: [PATCH] Rename JSGlobalProxy::context to native_context, for clarity and consistency with GlobalObject::native_context. R=svenpanne@chromium.org BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10861007 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12341 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/macro-assembler-arm.cc | 4 ++-- src/bootstrapper.cc | 7 ++++--- src/ia32/macro-assembler-ia32.cc | 5 +++-- src/isolate.cc | 2 +- src/mark-compact.cc | 2 +- src/mips/macro-assembler-mips.cc | 4 ++-- src/objects-debug.cc | 2 +- src/objects-inl.h | 2 +- src/objects-printer.cc | 4 ++-- src/objects.h | 8 ++++---- src/x64/macro-assembler-x64.cc | 7 ++++--- 11 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc index 47de95d..0be9722 100644 --- a/src/arm/macro-assembler-arm.cc +++ b/src/arm/macro-assembler-arm.cc @@ -1372,7 +1372,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, } // Check if both contexts are the same. - ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); + ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); cmp(scratch, Operand(ip)); b(eq, &same_contexts); @@ -1394,7 +1394,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, // Restore ip is not needed. ip is reloaded below. pop(holder_reg); // Restore holder. // Restore ip to holder's context. - ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); + ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); } // Check that the security token in the calling global object is diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index b936c2d..57acb37 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -327,7 +327,8 @@ static void SetObjectPrototype(Handle object, Handle proto) { void Bootstrapper::DetachGlobal(Handle env) { Factory* factory = env->GetIsolate()->factory(); - JSGlobalProxy::cast(env->global_proxy())->set_context(*factory->null_value()); + JSGlobalProxy::cast(env->global_proxy())-> + set_native_context(*factory->null_value()); SetObjectPrototype(Handle(env->global_proxy()), factory->null_value()); env->set_global_proxy(env->global_object()); @@ -342,7 +343,7 @@ void Bootstrapper::ReattachGlobal(Handle env, env->global_object()->set_global_receiver(*global); env->set_global_proxy(*global); SetObjectPrototype(global, Handle(env->global_object())); - global->set_context(*env); + global->set_native_context(*env); } @@ -797,7 +798,7 @@ void Genesis::HookUpGlobalProxy(Handle inner_global, // 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(*native_context()); + global_proxy->set_native_context(*native_context()); native_context()->set_global_proxy(*global_proxy); } diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index 4ebaa27..83aef78 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -999,7 +999,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, } // Check if both contexts are the same. - cmp(scratch, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); + cmp(scratch, FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); j(equal, &same_contexts); // Compare security tokens, save holder_reg on the stack so we can use it @@ -1010,7 +1010,8 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, // Check that the security token in the calling global object is // compatible with the security token in the receiving global // object. - mov(holder_reg, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); + mov(holder_reg, + FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); // Check the context is a native context. if (emit_debug_code()) { diff --git a/src/isolate.cc b/src/isolate.cc index 2933c97..76bfc9b 100644 --- a/src/isolate.cc +++ b/src/isolate.cc @@ -789,7 +789,7 @@ static MayAccessDecision MayAccessPreCheck(Isolate* isolate, if (isolate->bootstrapper()->IsActive()) return YES; if (receiver->IsJSGlobalProxy()) { - Object* receiver_context = JSGlobalProxy::cast(receiver)->context(); + Object* receiver_context = JSGlobalProxy::cast(receiver)->native_context(); if (!receiver_context->IsContext()) return NO; // Get the native context of current top context. diff --git a/src/mark-compact.cc b/src/mark-compact.cc index 8db48c3..df4739e 100644 --- a/src/mark-compact.cc +++ b/src/mark-compact.cc @@ -238,7 +238,7 @@ class VerifyNativeContextSeparationVisitor: public ObjectVisitor { CheckContext(JSFunction::cast(object)->context()); break; case JS_GLOBAL_PROXY_TYPE: - CheckContext(JSGlobalProxy::cast(object)->context()); + CheckContext(JSGlobalProxy::cast(object)->native_context()); break; case JS_GLOBAL_OBJECT_TYPE: case JS_BUILTINS_OBJECT_TYPE: diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index 6b27378..5156855 100644 --- a/src/mips/macro-assembler-mips.cc +++ b/src/mips/macro-assembler-mips.cc @@ -380,7 +380,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, } // Check if both contexts are the same. - lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); + lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); Branch(&same_contexts, eq, scratch, Operand(at)); // Check the context is a native context. @@ -399,7 +399,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, // Restore at is not needed. at is reloaded below. pop(holder_reg); // Restore holder. // Restore at to holder's context. - lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); + lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); } // Check that the security token in the calling global object is diff --git a/src/objects-debug.cc b/src/objects-debug.cc index 311cab6..756f046 100644 --- a/src/objects-debug.cc +++ b/src/objects-debug.cc @@ -521,7 +521,7 @@ void SharedFunctionInfo::SharedFunctionInfoVerify() { void JSGlobalProxy::JSGlobalProxyVerify() { CHECK(IsJSGlobalProxy()); JSObjectVerify(); - VerifyObjectField(JSGlobalProxy::kContextOffset); + VerifyObjectField(JSGlobalProxy::kNativeContextOffset); // Make sure that this object has no properties, elements. CHECK_EQ(0, properties()->length()); CHECK(HasFastObjectElements()); diff --git a/src/objects-inl.h b/src/objects-inl.h index a7e6e42..6c4cd54 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -3672,7 +3672,7 @@ ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) -ACCESSORS(JSGlobalProxy, context, Object, kContextOffset) +ACCESSORS(JSGlobalProxy, native_context, Object, kNativeContextOffset) ACCESSORS(AccessorInfo, getter, Object, kGetterOffset) ACCESSORS(AccessorInfo, setter, Object, kSetterOffset) diff --git a/src/objects-printer.cc b/src/objects-printer.cc index 3bc4fea..1ba0bb0 100644 --- a/src/objects-printer.cc +++ b/src/objects-printer.cc @@ -824,8 +824,8 @@ void SharedFunctionInfo::SharedFunctionInfoPrint(FILE* out) { void JSGlobalProxy::JSGlobalProxyPrint(FILE* out) { PrintF(out, "global_proxy "); JSObjectPrint(out); - PrintF(out, "context : "); - context()->ShortPrint(out); + PrintF(out, "native context : "); + native_context()->ShortPrint(out); PrintF(out, "\n"); } diff --git a/src/objects.h b/src/objects.h index 21ab35a..f30a8c9 100644 --- a/src/objects.h +++ b/src/objects.h @@ -6162,9 +6162,9 @@ class JSFunction: public JSObject { class JSGlobalProxy : public JSObject { public: - // [context]: the owner native context of this global proxy object. + // [native_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) + DECL_ACCESSORS(native_context, Object) // Casting. static inline JSGlobalProxy* cast(Object* obj); @@ -6181,8 +6181,8 @@ class JSGlobalProxy : public JSObject { #endif // Layout description. - static const int kContextOffset = JSObject::kHeaderSize; - static const int kSize = kContextOffset + kPointerSize; + static const int kNativeContextOffset = JSObject::kHeaderSize; + static const int kSize = kNativeContextOffset + kPointerSize; private: DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index 95c5713..6bd3a1c 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -3456,7 +3456,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, } // Check if both contexts are the same. - cmpq(scratch, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); + cmpq(scratch, FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); j(equal, &same_contexts); // Compare security tokens. @@ -3468,7 +3468,8 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, if (emit_debug_code()) { // Preserve original value of holder_reg. push(holder_reg); - movq(holder_reg, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); + movq(holder_reg, + FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); CompareRoot(holder_reg, Heap::kNullValueRootIndex); Check(not_equal, "JSGlobalProxy::context() should not be null."); @@ -3480,7 +3481,7 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, } movq(kScratchRegister, - FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); + FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); int token_offset = Context::kHeaderSize + Context::SECURITY_TOKEN_INDEX * kPointerSize; movq(scratch, FieldOperand(scratch, token_offset)); -- 2.7.4