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

Unified Diff: src/mips/builtins-mips.cc

Issue 1413003008: Support fast-path allocation for subclass constructors with correctly initialized initial maps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/builtins-mips.cc
diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc
index 8e6956f9a58c4eede4cecd66d8528a60c1d69386..08f8e65359cf31743ee10d3a0a53c9f772d24a5c 100644
--- a/src/mips/builtins-mips.cc
+++ b/src/mips/builtins-mips.cc
@@ -396,16 +396,22 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ lw(a2, MemOperand(a2));
__ Branch(&rt_call, ne, a2, Operand(zero_reg));
- // Fall back to runtime if the original constructor and function differ.
- __ Branch(&rt_call, ne, a1, Operand(a3));
+ // Verify that the original constructor is a JSFunction.
+ __ GetObjectType(a3, t1, t0);
+ __ Branch(&rt_call, ne, t0, Operand(JS_FUNCTION_TYPE));
// Load the initial map and verify that it is in fact a map.
- // a1: constructor function
- __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
+ // a3: original constructor
+ __ lw(a2, FieldMemOperand(a3, JSFunction::kPrototypeOrInitialMapOffset));
__ JumpIfSmi(a2, &rt_call);
__ GetObjectType(a2, t5, t4);
__ Branch(&rt_call, ne, t4, Operand(MAP_TYPE));
+ // Fall back to runtime if the expected base constructor and base
+ // constructor differ.
+ __ lw(t1, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset));
+ __ Branch(&rt_call, ne, a1, Operand(t1));
+
// Check that the constructor is not constructing a JSFunction (see
// comments in Runtime_NewObject in runtime.cc). In which case the
// initial map's instance type would be JS_FUNCTION_TYPE.
@@ -427,7 +433,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
Operand(Map::kSlackTrackingCounterEnd));
__ sw(t0, bit_field3); // In delay slot.
- __ Push(a1, a2, a1); // a1 = Constructor.
+ __ Push(a1, a2, a2); // a2 = Initial map.
__ CallRuntime(Runtime::kFinalizeInstanceSize, 1);
__ Pop(a1, a2);
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698