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

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

Issue 1341233002: X87: [stubs] Simplify the non-function case of CallConstructStub. (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/full-codegen/x87/full-codegen-x87.cc ('k') | no next file » | 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 daab993749557d8dc34db9e82c2ebc6e1dc351e6..c763401d7c4435f99df09321ce82fb11c2ac62e8 100644
--- a/src/x87/code-stubs-x87.cc
+++ b/src/x87/code-stubs-x87.cc
@@ -1885,26 +1885,32 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
// eax: number of arguments
// ecx: object map
// esp[0]: original receiver (for IsSuperConstructorCall)
- Label do_call;
__ bind(&slow);
- __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
- __ j(not_equal, &non_function_call);
- __ GetBuiltinEntry(edx,
- Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ jmp(&do_call);
-
- __ bind(&non_function_call);
- __ GetBuiltinEntry(edx,
- Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ bind(&do_call);
- if (IsSuperConstructorCall()) {
- __ Drop(1);
+ {
+ __ 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);
}
- // Set expected number of arguments to zero (not changing eax).
- __ Move(ebx, Immediate(0));
- Handle<Code> arguments_adaptor =
- isolate()->builtins()->ArgumentsAdaptorTrampoline();
- __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET);
}
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698