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

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

Issue 1360403002: Revert of [es6] Introduce spec compliant IsConstructor. (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/arm/builtins-arm.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm64/builtins-arm64.cc
diff --git a/src/arm64/builtins-arm64.cc b/src/arm64/builtins-arm64.cc
index 4fcc8f15f58454c2eea2466d6d2cbf09dc606f4e..53cf0eccbdd64470ff85ff63194596f740150859 100644
--- a/src/arm64/builtins-arm64.cc
+++ b/src/arm64/builtins-arm64.cc
@@ -1708,21 +1708,6 @@
// static
-void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
- // ----------- S t a t e -------------
- // -- x0 : the number of arguments (not including the receiver)
- // -- x1 : the constructor to call (checked to be a JSFunctionProxy)
- // -- x3 : the original constructor (either the same as the constructor or
- // the JSFunction on which new was invoked initially)
- // -----------------------------------
-
- // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
- __ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kConstructTrapOffset));
- __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
-}
-
-
-// static
void Builtins::Generate_Construct(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- x0 : the number of arguments (not including the receiver)
@@ -1731,34 +1716,34 @@
// the JSFunction on which new was invoked initially)
// -----------------------------------
- // Check if target has a [[Construct]] internal method.
- Label non_constructor;
- __ JumpIfSmi(x1, &non_constructor);
- __ Ldr(x4, FieldMemOperand(x1, HeapObject::kMapOffset));
- __ Ldrb(x2, FieldMemOperand(x4, Map::kBitFieldOffset));
- __ TestAndBranchIfAllClear(x2, 1 << Map::kIsConstructor, &non_constructor);
-
- // Dispatch based on instance type.
- __ CompareInstanceType(x4, x5, JS_FUNCTION_TYPE);
+ Label non_callable, non_function;
+ __ JumpIfSmi(x1, &non_callable);
+ __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE);
__ Jump(masm->isolate()->builtins()->ConstructFunction(),
RelocInfo::CODE_TARGET, eq);
__ Cmp(x5, JS_FUNCTION_PROXY_TYPE);
- __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
- eq);
-
- // Called Construct on an exotic Object with a [[Construct]] internal method.
- {
- // Overwrite the original receiver with the (original) target.
- __ Poke(x1, Operand(x0, LSL, kXRegSizeLog2));
- // Let the "call_as_constructor_delegate" take care of the rest.
- __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, x1);
- __ Jump(masm->isolate()->builtins()->CallFunction(),
- RelocInfo::CODE_TARGET);
- }
-
- // Called Construct on an Object that doesn't have a [[Construct]] internal
- // method.
- __ bind(&non_constructor);
+ __ B(ne, &non_function);
+
+ // 1. Construct of function proxy.
+ // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
+ __ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kConstructTrapOffset));
+ __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
+
+ // 2. Construct of something that else, which might have a [[Construct]]
+ // internal method (if not we raise an exception).
+ __ Bind(&non_function);
+ // Check if target has a [[Call]] internal method.
+ // TODO(bmeurer): This shoud use IsConstructor once available.
+ __ Ldrb(x4, FieldMemOperand(x4, Map::kBitFieldOffset));
+ __ TestAndBranchIfAllClear(x4, 1 << Map::kIsCallable, &non_callable);
+ // Overwrite the original receiver with the (original) target.
+ __ Poke(x1, Operand(x0, LSL, kXRegSizeLog2));
+ // Let the "call_as_constructor_delegate" take care of the rest.
+ __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, x1);
+ __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET);
+
+ // 3. Construct of something that is not callable.
+ __ bind(&non_callable);
{
FrameScope scope(masm, StackFrame::INTERNAL);
__ Push(x1);
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698