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/arm64/code-stubs-arm64.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/arm64/builtins-arm64.cc ('k') | src/globals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm64/code-stubs-arm64.cc
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc
index 0a7b4752656e9c2c589e31d0d338a5d4b9d8c5c3..e23a221dd8012a9057f1844d0ebd646f62a89bef 100644
--- a/src/arm64/code-stubs-arm64.cc
+++ b/src/arm64/code-stubs-arm64.cc
@@ -2747,10 +2747,22 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, Register argc,
}
-static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) {
+static void LoadCompilerHints(MacroAssembler* masm) {
+ // ----------- S t a t e -------------
+ // -- x1 : the function to call
+ // -----------------------------------
// Do not transform the receiver for strict mode functions.
__ Ldr(x3, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
__ Ldr(w4, FieldMemOperand(x3, SharedFunctionInfo::kCompilerHintsOffset));
+}
+
+
+static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) {
+ // ----------- S t a t e -------------
+ // -- a1 : the function to call
+ // -- x3 : the shared function info
+ // -- w4 : the compiler info hints from the shared function info
+ // -----------------------------------
__ Tbnz(w4, SharedFunctionInfo::kStrictModeFunction, cont);
// Do not transform the receiver for native (Compilerhints already in x3).
@@ -2778,6 +2790,26 @@ static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) {
}
+static void EmitClassConstructorCallCheck(MacroAssembler* masm) {
+ // ----------- S t a t e -------------
+ // -- x1 : the function to call
+ // -- x3 : the shared function info
+ // -- w4 : the shared function's compiler hints
+ // -----------------------------------
+ // ClassConstructor Check: ES6 section 9.2.1 [[Call]]
+ Label non_class_constructor;
+ __ TestAndBranchIfAllClear(
+ w4, (1 << SharedFunctionInfo::kIsDefaultConstructor) |
+ (1 << SharedFunctionInfo::kIsSubclassConstructor) |
+ (1 << SharedFunctionInfo::kIsBaseConstructor),
+ &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) {
@@ -2797,6 +2829,9 @@ static void CallFunctionNoFeedback(MacroAssembler* masm,
__ JumpIfNotObjectType(function, x10, type, JS_FUNCTION_TYPE, &slow);
}
+ LoadCompilerHints(masm);
+ EmitClassConstructorCallCheck(masm);
+
// Fast-case: Invoke the function now.
// x1 function pushed function
ParameterCount actual(argc);
@@ -2989,6 +3024,10 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ Str(index, FieldMemOperand(feedback_vector, 0));
__ bind(&have_js_function);
+
+ LoadCompilerHints(masm);
+ EmitClassConstructorCallCheck(masm);
+
if (CallAsMethod()) {
EmitContinueIfStrictOrNative(masm, &cont);
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698