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

Unified Diff: src/mips/code-stubs-mips.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/mips/builtins-mips.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 3cf1145a1931b4e3cb4136000a86cfe0c68dd1fd..68951ba3f74c285a9b2924bb1563d51787b43a9d 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -2503,7 +2503,10 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) {
static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) {
- __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
+ // ----------- S t a t e -------------
+ // -- a1 : the function to call
+ // -- a3 : the function's shared function info
+ // -----------------------------------
__ lw(t0, FieldMemOperand(a3, SharedFunctionInfo::kCompilerHintsOffset));
// Do not transform the receiver for strict mode functions.
@@ -2536,6 +2539,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 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.
+ __ lbu(t0, FieldMemOperand(a3, SharedFunctionInfo::kFunctionKindByteOffset));
+ __ And(at, t0, Operand(SharedFunctionInfo::kClassConstructorBitsWithinByte));
+ __ Branch(&non_class_constructor, eq, at, Operand(zero_reg));
+ // Step: 2, If we call a classConstructor Function throw a TypeError.
+ __ 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) {
@@ -2552,6 +2572,9 @@ static void CallFunctionNoFeedback(MacroAssembler* masm,
__ Branch(&slow, ne, t0, Operand(JS_FUNCTION_TYPE));
}
+ __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
+ EmitClassConstructorCallCheck(masm);
+
// Fast-case: Invoke the function now.
// a1: pushed function
ParameterCount actual(argc);
@@ -2719,6 +2742,10 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ sw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize));
__ bind(&have_js_function);
+
+ __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
+ EmitClassConstructorCallCheck(masm);
+
if (CallAsMethod()) {
EmitContinueIfStrictOrNative(masm, &cont);
// Compute the receiver in sloppy mode.
« no previous file with comments | « src/mips/builtins-mips.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698