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

Side by Side Diff: src/arm/full-codegen-arm.cc

Issue 911363002: Revert of new classes: implement new.target passing to superclass constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 int offset = num_parameters * kPointerSize; 255 int offset = num_parameters * kPointerSize;
256 __ add(r2, fp, 256 __ add(r2, fp,
257 Operand(StandardFrameConstants::kCallerSPOffset + offset)); 257 Operand(StandardFrameConstants::kCallerSPOffset + offset));
258 __ mov(r1, Operand(Smi::FromInt(num_parameters))); 258 __ mov(r1, Operand(Smi::FromInt(num_parameters)));
259 __ Push(r3, r2, r1); 259 __ Push(r3, r2, r1);
260 260
261 // Arguments to ArgumentsAccessStub: 261 // Arguments to ArgumentsAccessStub:
262 // function, receiver address, parameter count. 262 // function, receiver address, parameter count.
263 // The stub will rewrite receiever and parameter count if the previous 263 // The stub will rewrite receiever and parameter count if the previous
264 // stack frame was an arguments adapter frame. 264 // stack frame was an arguments adapter frame.
265 ArgumentsAccessStub::HasNewTarget has_new_target =
266 IsSubclassConstructor(info->function()->kind())
267 ? ArgumentsAccessStub::HAS_NEW_TARGET
268 : ArgumentsAccessStub::NO_NEW_TARGET;
269 ArgumentsAccessStub::Type type; 265 ArgumentsAccessStub::Type type;
270 if (is_strict(language_mode())) { 266 if (is_strict(language_mode())) {
271 type = ArgumentsAccessStub::NEW_STRICT; 267 type = ArgumentsAccessStub::NEW_STRICT;
272 } else if (function()->has_duplicate_parameters()) { 268 } else if (function()->has_duplicate_parameters()) {
273 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 269 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
274 } else { 270 } else {
275 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 271 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
276 } 272 }
277 ArgumentsAccessStub stub(isolate(), type, has_new_target); 273 ArgumentsAccessStub stub(isolate(), type);
278 __ CallStub(&stub); 274 __ CallStub(&stub);
279 275
280 SetVar(arguments, r0, r1, r2); 276 SetVar(arguments, r0, r1, r2);
281 } 277 }
282 278
283 if (FLAG_trace) { 279 if (FLAG_trace) {
284 __ CallRuntime(Runtime::kTraceEnter, 0); 280 __ CallRuntime(Runtime::kTraceEnter, 0);
285 } 281 }
286 282
287 // Visit the declarations and body unless there is an illegal 283 // Visit the declarations and body unless there is an illegal
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 __ bind(&ok); 443 __ bind(&ok);
448 444
449 #ifdef DEBUG 445 #ifdef DEBUG
450 // Add a label for checking the size of the code used for returning. 446 // Add a label for checking the size of the code used for returning.
451 Label check_exit_codesize; 447 Label check_exit_codesize;
452 __ bind(&check_exit_codesize); 448 __ bind(&check_exit_codesize);
453 #endif 449 #endif
454 // Make sure that the constant pool is not emitted inside of the return 450 // Make sure that the constant pool is not emitted inside of the return
455 // sequence. 451 // sequence.
456 { Assembler::BlockConstPoolScope block_const_pool(masm_); 452 { Assembler::BlockConstPoolScope block_const_pool(masm_);
457 int32_t arg_count = info_->scope()->num_parameters() + 1; 453 int32_t sp_delta = (info_->scope()->num_parameters() + 1) * kPointerSize;
458 if (FLAG_experimental_classes &&
459 IsSubclassConstructor(info_->function()->kind())) {
460 arg_count++;
461 }
462 int32_t sp_delta = arg_count * kPointerSize;
463 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); 454 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
464 // TODO(svenpanne) The code below is sometimes 4 words, sometimes 5! 455 // TODO(svenpanne) The code below is sometimes 4 words, sometimes 5!
465 PredictableCodeSizeScope predictable(masm_, -1); 456 PredictableCodeSizeScope predictable(masm_, -1);
466 __ RecordJSReturn(); 457 __ RecordJSReturn();
467 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT); 458 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT);
468 { ConstantPoolUnavailableScope constant_pool_unavailable(masm_); 459 { ConstantPoolUnavailableScope constant_pool_unavailable(masm_);
469 __ add(sp, sp, Operand(sp_delta)); 460 __ add(sp, sp, Operand(sp_delta));
470 __ Jump(lr); 461 __ Jump(lr);
471 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); 462 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset());
472 } 463 }
(...skipping 2786 matching lines...) Expand 10 before | Expand all | Expand 10 after
3259 __ mov(r3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); 3250 __ mov(r3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot())));
3260 3251
3261 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 3252 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
3262 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3253 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3263 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3254 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3264 context()->Plug(r0); 3255 context()->Plug(r0);
3265 } 3256 }
3266 3257
3267 3258
3268 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3259 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3269 Comment cmnt(masm_, "[ SuperConstructorCall");
3270 Variable* new_target_var = scope()->DeclarationScope()->new_target_var();
3271 GetVar(result_register(), new_target_var);
3272 __ Push(result_register());
3273
3274 SuperReference* super_ref = expr->expression()->AsSuperReference(); 3260 SuperReference* super_ref = expr->expression()->AsSuperReference();
3275 EmitLoadSuperConstructor(super_ref); 3261 EmitLoadSuperConstructor(super_ref);
3276 __ push(result_register()); 3262 __ push(result_register());
3277 3263
3278 Variable* this_var = super_ref->this_var()->var(); 3264 Variable* this_var = super_ref->this_var()->var();
3279 3265
3280 GetVar(r0, this_var); 3266 GetVar(r0, this_var);
3281 __ CompareRoot(r0, Heap::kTheHoleValueRootIndex); 3267 __ CompareRoot(r0, Heap::kTheHoleValueRootIndex);
3282 Label uninitialized_this; 3268 Label uninitialized_this;
3283 __ b(eq, &uninitialized_this); 3269 __ b(eq, &uninitialized_this);
(...skipping 23 matching lines...) Expand all
3307 /* TODO(dslomov): support pretenuring. 3293 /* TODO(dslomov): support pretenuring.
3308 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); 3294 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot());
3309 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == 3295 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() ==
3310 expr->CallNewFeedbackSlot().ToInt() + 1); 3296 expr->CallNewFeedbackSlot().ToInt() + 1);
3311 */ 3297 */
3312 } 3298 }
3313 3299
3314 __ Move(r2, FeedbackVector()); 3300 __ Move(r2, FeedbackVector());
3315 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); 3301 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3316 3302
3317 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 3303 // TODO(dslomov): use a different stub and propagate new.target.
3304 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
3318 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3305 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3319 3306
3320 __ Drop(1);
3321
3322 RecordJSReturnSite(expr); 3307 RecordJSReturnSite(expr);
3323 3308
3324 EmitVariableAssignment(this_var, Token::INIT_CONST); 3309 EmitVariableAssignment(this_var, Token::INIT_CONST);
3325 context()->Plug(r0); 3310 context()->Plug(r0);
3326 } 3311 }
3327 3312
3328 3313
3329 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3314 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3330 ZoneList<Expression*>* args = expr->arguments(); 3315 ZoneList<Expression*>* args = expr->arguments();
3331 DCHECK(args->length() == 1); 3316 DCHECK(args->length() == 1);
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after
5441 5426
5442 DCHECK(interrupt_address == 5427 DCHECK(interrupt_address ==
5443 isolate->builtins()->OsrAfterStackCheck()->entry()); 5428 isolate->builtins()->OsrAfterStackCheck()->entry());
5444 return OSR_AFTER_STACK_CHECK; 5429 return OSR_AFTER_STACK_CHECK;
5445 } 5430 }
5446 5431
5447 5432
5448 } } // namespace v8::internal 5433 } } // namespace v8::internal
5449 5434
5450 #endif // V8_TARGET_ARCH_ARM 5435 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« 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