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

Unified Diff: src/arm/full-codegen-arm.cc

Issue 1196193014: Do not add extra argument for new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment added Created 5 years, 6 months 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/code-stubs-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/full-codegen-arm.cc
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
index 9931e0a8066711a42b70493bb6a8cb5753f2215e..e91050630e0f1354cf71078d0c5cadd971ab37b3 100644
--- a/src/arm/full-codegen-arm.cc
+++ b/src/arm/full-codegen-arm.cc
@@ -249,18 +249,27 @@ void FullCodeGenerator::Generate() {
Variable* new_target_var = scope()->new_target_var();
if (new_target_var != nullptr) {
Comment cmnt(masm_, "[ new.target");
- // new.target is parameter -2.
- int offset = 2 * kPointerSize +
- (info_->scope()->num_parameters() + 1) * kPointerSize;
- __ ldr(r0, MemOperand(fp, offset));
+
+ __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
+ __ ldr(r1, MemOperand(r2, StandardFrameConstants::kContextOffset));
+ __ cmp(r1, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
arv (Not doing code reviews) 2015/06/26 00:47:41 You missed a branch here.
arv (Not doing code reviews) 2015/06/26 15:15:33 Never mind... I see the trailing eq now... Somethi
+ __ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset), eq);
+ __ ldr(r1, MemOperand(r2, StandardFrameConstants::kMarkerOffset));
+ __ cmp(r1, Operand(Smi::FromInt(StackFrame::CONSTRUCT)));
+ Label non_construct_frame, done;
+
+ __ b(ne, &non_construct_frame);
+ __ ldr(r0, MemOperand(r2, StandardFrameConstants::kExpressionsOffset -
+ 2 * kPointerSize));
+ __ b(&done);
+
+ __ bind(&non_construct_frame);
+ __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
+ __ bind(&done);
+
SetVar(new_target_var, r0, r2, r3);
}
- ArgumentsAccessStub::HasNewTarget has_new_target =
- IsSubclassConstructor(info->function()->kind())
- ? ArgumentsAccessStub::HAS_NEW_TARGET
- : ArgumentsAccessStub::NO_NEW_TARGET;
-
// Possibly allocate RestParameters
int rest_index;
Variable* rest_param = scope()->rest_parameter(&rest_index);
@@ -269,10 +278,6 @@ void FullCodeGenerator::Generate() {
int num_parameters = info->scope()->num_parameters();
int offset = num_parameters * kPointerSize;
- if (has_new_target == ArgumentsAccessStub::HAS_NEW_TARGET) {
- --num_parameters;
- ++rest_index;
- }
__ add(r3, fp, Operand(StandardFrameConstants::kCallerSPOffset + offset));
__ mov(r2, Operand(Smi::FromInt(num_parameters)));
@@ -299,8 +304,8 @@ void FullCodeGenerator::Generate() {
// Receiver is just before the parameters on the caller's stack.
int num_parameters = info->scope()->num_parameters();
int offset = num_parameters * kPointerSize;
- __ add(r2, fp,
- Operand(StandardFrameConstants::kCallerSPOffset + offset));
+
+ __ add(r2, fp, Operand(StandardFrameConstants::kCallerSPOffset + offset));
__ mov(r1, Operand(Smi::FromInt(num_parameters)));
__ Push(r3, r2, r1);
@@ -316,7 +321,7 @@ void FullCodeGenerator::Generate() {
} else {
type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
}
- ArgumentsAccessStub stub(isolate(), type, has_new_target);
+ ArgumentsAccessStub stub(isolate(), type);
__ CallStub(&stub);
SetVar(arguments, r0, r1, r2);
@@ -498,9 +503,6 @@ void FullCodeGenerator::EmitReturnSequence() {
// sequence.
{ Assembler::BlockConstPoolScope block_const_pool(masm_);
int32_t arg_count = info_->scope()->num_parameters() + 1;
- if (IsSubclassConstructor(info_->function()->kind())) {
- arg_count++;
- }
int32_t sp_delta = arg_count * kPointerSize;
CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
// TODO(svenpanne) The code below is sometimes 4 words, sometimes 5!
@@ -4281,9 +4283,6 @@ void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
__ bind(&adaptor_frame);
__ ldr(r1, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset));
__ SmiUntag(r1, r1);
-
- // Subtract 1 from arguments count, for new.target.
- __ sub(r1, r1, Operand(1));
__ mov(r0, r1);
// Get arguments pointer in r2.
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698