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

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

Issue 1469793002: [builtins] Sanitize the machinery around Construct calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mips64 fix. 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/interface-descriptors.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/builtins-mips.cc
diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc
index 4317af957b45fb1fd151b27d1efb3fa4160f6907..38bfc551afd47917c75f6e41141ab90b6c57bb77 100644
--- a/src/mips/builtins-mips.cc
+++ b/src/mips/builtins-mips.cc
@@ -1398,11 +1398,11 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
// Use undefined feedback vector
__ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
__ lw(a1, MemOperand(fp, kFunctionOffset));
- __ lw(t0, MemOperand(fp, kNewTargetOffset));
+ __ lw(a3, MemOperand(fp, kNewTargetOffset));
// Call the function.
- CallConstructStub stub(masm->isolate(), SUPER_CONSTRUCTOR_CALL);
- __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
+ __ Call(masm->isolate()->builtins()->Construct(),
+ RelocInfo::CONSTRUCT_CALL);
// Leave internal frame.
}
@@ -1677,21 +1677,23 @@ void Builtins::Generate_Construct(MacroAssembler* masm) {
// the JSFunction on which new was invoked initially)
// -----------------------------------
- // Check if target has a [[Construct]] internal method.
+ // Check if target is a Smi.
Label non_constructor;
__ JumpIfSmi(a1, &non_constructor);
- __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset));
- __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset));
- __ And(t2, t2, Operand(1 << Map::kIsCallable));
- __ Branch(&non_constructor, eq, t2, Operand(zero_reg));
// Dispatch based on instance type.
+ __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset));
__ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset));
__ Jump(masm->isolate()->builtins()->ConstructFunction(),
RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE));
__ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
eq, t2, Operand(JS_FUNCTION_PROXY_TYPE));
+ // Check if target has a [[Construct]] internal method.
+ __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset));
+ __ And(t2, t2, Operand(1 << Map::kIsCallable));
+ __ Branch(&non_constructor, eq, t2, Operand(zero_reg));
+
// Called Construct on an exotic Object with a [[Construct]] internal method.
{
// Overwrite the original receiver with the (original) target.
« no previous file with comments | « src/interface-descriptors.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698