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

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

Issue 1418623007: [runtime] Fix ES6 9.2.1 [[Call]] when encountering a classConstructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do not use kNear jump on x64 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/arm/builtins-arm.cc ('k') | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index d85ebdb114c76ba4a3f9a9796d2154814e678ab8..8ccc44d3f293cece10ed31e0f73865dc043e9aa2 100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -2380,8 +2380,11 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) {
static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) {
+ // ----------- S t a t e -------------
+ // -- r1 : the function to call
+ // -- r3 : the function's shared function info
+ // -----------------------------------
// Do not transform the receiver for strict mode functions.
- __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
__ ldr(r4, FieldMemOperand(r3, SharedFunctionInfo::kCompilerHintsOffset));
__ tst(r4, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
kSmiTagSize)));
@@ -2413,6 +2416,24 @@ static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) {
}
+static void EmitClassConstructorCallCheck(MacroAssembler* masm) {
+ // ----------- S t a t e -------------
+ // -- r1 : the function to call
+ // -- r3 : the function's shared function info
+ // -----------------------------------
+ // ClassConstructor Check: ES6 section 9.2.1 [[Call]]
+ Label non_class_constructor;
+ // Check whether the current function is a classConstructor.
+ __ ldrb(r4, FieldMemOperand(r3, SharedFunctionInfo::kFunctionKindByteOffset));
+ __ tst(r4, Operand(SharedFunctionInfo::kClassConstructorBitsWithinByte));
+ __ b(eq, &non_class_constructor);
+ // If we call a classConstructor Function throw a TypeError
+ // indirectly via the CallFunction builtin.
+ __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET);
+ __ bind(&non_class_constructor);
+}
+
+
static void CallFunctionNoFeedback(MacroAssembler* masm,
int argc, bool needs_checks,
bool call_as_method) {
@@ -2429,6 +2450,9 @@ static void CallFunctionNoFeedback(MacroAssembler* masm,
__ b(ne, &slow);
}
+ __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
+ EmitClassConstructorCallCheck(masm);
+
// Fast-case: Invoke the function now.
// r1: pushed function
ParameterCount actual(argc);
@@ -2594,6 +2618,10 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ str(r3, FieldMemOperand(r2, 0));
__ bind(&have_js_function);
+
+ __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
+ EmitClassConstructorCallCheck(masm);
+
if (CallAsMethod()) {
EmitContinueIfStrictOrNative(masm, &cont);
// Compute the receiver in sloppy mode.
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698