Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: src/crankshaft/hydrogen.cc

Issue 1480003002: [runtime] Replace global object link with native context link in all contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add patch from Orion for interpreter cementation test. Disable obsolete/invalid tests. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/crankshaft/arm64/lithium-codegen-arm64.cc ('k') | src/crankshaft/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index 6d5a81460b7dbe68a19751e5c3df74cf85ad0bd8..e1cf7d808035bc4ac41a6187c2fdda76c7f60cc9 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -1859,11 +1859,9 @@ HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length,
NOT_TENURED, JS_ARRAY_TYPE);
// Initialize the JSRegExpResult header.
- HValue* global_object = Add<HLoadNamedField>(
- context(), nullptr,
- HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
HValue* native_context = Add<HLoadNamedField>(
- global_object, nullptr, HObjectAccess::ForJSGlobalObjectNativeContext());
+ context(), nullptr,
+ HObjectAccess::ForContextSlot(Context::NATIVE_CONTEXT_INDEX));
Add<HStoreNamedField>(
result, HObjectAccess::ForMap(),
Add<HLoadNamedField>(
@@ -3260,13 +3258,9 @@ void HGraphBuilder::BuildCreateAllocationMemento(
HInstruction* HGraphBuilder::BuildGetNativeContext() {
- // Get the global object, then the native context
- HValue* global_object = Add<HLoadNamedField>(
+ return Add<HLoadNamedField>(
context(), nullptr,
- HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
- return Add<HLoadNamedField>(global_object, nullptr,
- HObjectAccess::ForObservableJSObjectOffset(
- JSGlobalObject::kNativeContextOffset));
+ HObjectAccess::ForContextSlot(Context::NATIVE_CONTEXT_INDEX));
}
@@ -3274,12 +3268,9 @@ HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) {
// Get the global object, then the native context
HInstruction* context = Add<HLoadNamedField>(
closure, nullptr, HObjectAccess::ForFunctionContextPointer());
- HInstruction* global_object = Add<HLoadNamedField>(
+ return Add<HLoadNamedField>(
context, nullptr,
- HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
- HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset(
- JSGlobalObject::kNativeContextOffset);
- return Add<HLoadNamedField>(global_object, nullptr, access);
+ HObjectAccess::ForContextSlot(Context::NATIVE_CONTEXT_INDEX));
}
@@ -3550,12 +3541,7 @@ HAllocate* HGraphBuilder::JSArrayBuilder::AllocateArray(
HValue* HGraphBuilder::AddLoadJSBuiltin(int context_index) {
- HValue* global_object = Add<HLoadNamedField>(
- context(), nullptr,
- HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
- HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset(
- JSGlobalObject::kNativeContextOffset);
- HValue* native_context = Add<HLoadNamedField>(global_object, nullptr, access);
+ HValue* native_context = BuildGetNativeContext();
HObjectAccess function_access = HObjectAccess::ForContextSlot(context_index);
return Add<HLoadNamedField>(native_context, nullptr, function_access);
}
@@ -5714,8 +5700,8 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
}
} else {
HValue* global_object = Add<HLoadNamedField>(
- context(), nullptr,
- HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
+ BuildGetNativeContext(), nullptr,
+ HObjectAccess::ForContextSlot(Context::EXTENSION_INDEX));
HLoadGlobalGeneric* instr = New<HLoadGlobalGeneric>(
global_object, variable->name(), ast_context()->typeof_mode());
instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()),
@@ -6928,8 +6914,8 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
}
} else {
HValue* global_object = Add<HLoadNamedField>(
- context(), nullptr,
- HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
+ BuildGetNativeContext(), nullptr,
+ HObjectAccess::ForContextSlot(Context::EXTENSION_INDEX));
HStoreNamedGeneric* instr =
Add<HStoreNamedGeneric>(global_object, var->name(), value,
function_language_mode(), PREMONOMORPHIC);
@@ -10031,11 +10017,7 @@ HValue* HGraphBuilder::BuildAllocateEmptyArrayBuffer(HValue* byte_length) {
BuildAllocate(Add<HConstant>(JSArrayBuffer::kSizeWithInternalFields),
HType::JSObject(), JS_ARRAY_BUFFER_TYPE, HAllocationMode());
- HValue* global_object = Add<HLoadNamedField>(
- context(), nullptr,
- HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
- HValue* native_context = Add<HLoadNamedField>(
- global_object, nullptr, HObjectAccess::ForJSGlobalObjectNativeContext());
+ HValue* native_context = BuildGetNativeContext();
Add<HStoreNamedField>(
result, HObjectAccess::ForMap(),
Add<HLoadNamedField>(
« no previous file with comments | « src/crankshaft/arm64/lithium-codegen-arm64.cc ('k') | src/crankshaft/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698