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

Unified Diff: src/x87/code-stubs-x87.cc

Issue 1362573002: X87: [builtins] Add support for NewTarget to Execution::New. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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/x87/builtins-x87.cc ('k') | src/x87/frames-x87.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/code-stubs-x87.cc
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc
index d4834191053c5d83f55a556cd37f01265fd02017..19fab74949e8eed05386c90366bf7e0cd687db55 100644
--- a/src/x87/code-stubs-x87.cc
+++ b/src/x87/code-stubs-x87.cc
@@ -1819,17 +1819,17 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
// ecx : original constructor (for IsSuperConstructorCall)
// edx : slot in feedback vector (Smi, for RecordCallTarget)
// edi : constructor function
- Label slow, non_function_call;
if (IsSuperConstructorCall()) {
__ push(ecx);
}
+ Label non_function;
// Check that function is not a smi.
- __ JumpIfSmi(edi, &non_function_call);
+ __ JumpIfSmi(edi, &non_function);
// Check that function is a JSFunction.
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
- __ j(not_equal, &slow);
+ __ j(not_equal, &non_function);
if (RecordCallTarget()) {
GenerateRecordCallTarget(masm, IsSuperConstructorCall());
@@ -1855,44 +1855,17 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
__ mov(edx, edi);
}
- // Jump to the function-specific construct stub.
- Register jmp_reg = ecx;
- __ mov(jmp_reg, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
- __ mov(jmp_reg, FieldOperand(jmp_reg,
- SharedFunctionInfo::kConstructStubOffset));
- __ lea(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize));
- __ jmp(jmp_reg);
-
- // edi: called object
- // eax: number of arguments
- // ecx: object map
- // esp[0]: original receiver (for IsSuperConstructorCall)
- __ bind(&slow);
- {
- __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
- __ j(not_equal, &non_function_call, Label::kNear);
- if (IsSuperConstructorCall()) __ Drop(1);
- // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
- __ mov(edi, FieldOperand(edi, JSFunctionProxy::kConstructTrapOffset));
- __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
-
- __ bind(&non_function_call);
- if (IsSuperConstructorCall()) __ Drop(1);
- {
- // Determine the delegate for the target (if any).
- FrameScope scope(masm, StackFrame::INTERNAL);
- __ SmiTag(eax);
- __ Push(eax);
- __ Push(edi);
- __ CallRuntime(Runtime::kGetConstructorDelegate, 1);
- __ mov(edi, eax);
- __ Pop(eax);
- __ SmiUntag(eax);
- }
- // The delegate is always a regular function.
- __ AssertFunction(edi);
- __ Jump(isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET);
- }
+ // Tail call to the function-specific construct stub (still in the caller
+ // context at this point).
+ __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
+ __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kConstructStubOffset));
+ __ lea(ecx, FieldOperand(ecx, Code::kHeaderSize));
+ __ jmp(ecx);
+
+ __ bind(&non_function);
+ if (IsSuperConstructorCall()) __ Drop(1);
+ __ mov(edx, edi);
+ __ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
}
« no previous file with comments | « src/x87/builtins-x87.cc ('k') | src/x87/frames-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698