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

Unified Diff: src/mips64/code-stubs-mips64.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/mips64/builtins-mips64.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/code-stubs-mips64.cc
diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc
index bb6deb92c2443d508c53546f00df5daf691dbe11..d522787735114036f9244534032d9fdb1ddf46ef 100644
--- a/src/mips64/code-stubs-mips64.cc
+++ b/src/mips64/code-stubs-mips64.cc
@@ -2539,8 +2539,10 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) {
static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) {
- __ ld(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
-
+ // ----------- S t a t e -------------
+ // -- a1 : the function to call
+ // -- a3 : the shared function info
+ // -----------------------------------
// Do not transform the receiver for strict mode functions.
int32_t strict_mode_function_mask =
1 << SharedFunctionInfo::kStrictModeBitWithinByte;
@@ -2576,6 +2578,23 @@ static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) {
}
+static void EmitClassConstructorCallCheck(MacroAssembler* masm) {
+ // ----------- S t a t e -------------
+ // -- a1 : the function to call
+ // -- a3 : the shared function info
+ // -----------------------------------
+ // ClassConstructor Check: ES6 section 9.2.1 [[Call]]
+ Label non_class_constructor;
+ __ lbu(a4, FieldMemOperand(a3, SharedFunctionInfo::kFunctionKindByteOffset));
+ __ And(at, a4, Operand(SharedFunctionInfo::kClassConstructorBitsWithinByte));
+ __ Branch(&non_class_constructor, eq, at, Operand(zero_reg));
+ // 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) {
@@ -2592,6 +2611,9 @@ static void CallFunctionNoFeedback(MacroAssembler* masm,
__ Branch(&slow, ne, a4, Operand(JS_FUNCTION_TYPE));
}
+ __ ld(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
+ EmitClassConstructorCallCheck(masm);
+
// Fast-case: Invoke the function now.
// a1: pushed function
ParameterCount actual(argc);
@@ -2798,6 +2820,10 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ sd(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize));
__ bind(&have_js_function);
+
+ __ ld(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
+ EmitClassConstructorCallCheck(masm);
+
if (CallAsMethod()) {
EmitContinueIfStrictOrNative(masm, &cont);
// Compute the receiver in sloppy mode.
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698