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

Unified Diff: src/hydrogen.cc

Issue 128683002: Array constructor can be simplified by loading context from JSFunction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Simple ports. Created 6 years, 11 months 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/hydrogen.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 3c4ff159eb22b9b92595a5843f83c492c6c2d589..69969bdf28113dde6f0a47a23dd1db63536d4a0b 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -2657,6 +2657,18 @@ void HGraphBuilder::BuildCreateAllocationMemento(
}
+HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) {
+ // Get the global context, then the native context
+ HInstruction* context =
+ Add<HLoadNamedField>(closure, HObjectAccess::ForFunctionContextPointer());
+ HInstruction* global_object = Add<HLoadNamedField>(context,
+ HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
+ HObjectAccess access = HObjectAccess::ForJSObjectOffset(
+ GlobalObject::kNativeContextOffset);
+ return Add<HLoadNamedField>(global_object, access);
+}
+
+
HInstruction* HGraphBuilder::BuildGetNativeContext() {
// Get the global context, then the native context
HInstruction* global_object = Add<HGlobalObject>();
@@ -2716,7 +2728,12 @@ HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode() {
return builder()->AddLoadNamedField(constructor_function_, access);
}
- HInstruction* native_context = builder()->BuildGetNativeContext();
+ // TODO(mvstanton): we should always have a constructor function if we
+ // are creating a stub.
+ HInstruction* native_context = constructor_function_ != NULL
+ ? builder()->BuildGetNativeContext(constructor_function_)
+ : builder()->BuildGetNativeContext();
+
HInstruction* index = builder()->Add<HConstant>(
static_cast<int32_t>(Context::JS_ARRAY_MAPS_INDEX));
« no previous file with comments | « src/hydrogen.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698