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

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

Issue 906813003: MIPS: 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/mips/code-stubs-mips.cc ('k') | src/mips64/builtins-mips64.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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 int offset = num_parameters * kPointerSize; 264 int offset = num_parameters * kPointerSize;
265 __ Addu(a2, fp, 265 __ Addu(a2, fp,
266 Operand(StandardFrameConstants::kCallerSPOffset + offset)); 266 Operand(StandardFrameConstants::kCallerSPOffset + offset));
267 __ li(a1, Operand(Smi::FromInt(num_parameters))); 267 __ li(a1, Operand(Smi::FromInt(num_parameters)));
268 __ Push(a3, a2, a1); 268 __ Push(a3, a2, a1);
269 269
270 // Arguments to ArgumentsAccessStub: 270 // Arguments to ArgumentsAccessStub:
271 // function, receiver address, parameter count. 271 // function, receiver address, parameter count.
272 // The stub will rewrite receiever and parameter count if the previous 272 // The stub will rewrite receiever and parameter count if the previous
273 // stack frame was an arguments adapter frame. 273 // stack frame was an arguments adapter frame.
274 ArgumentsAccessStub::HasNewTarget has_new_target =
275 IsSubclassConstructor(info->function()->kind())
276 ? ArgumentsAccessStub::HAS_NEW_TARGET
277 : ArgumentsAccessStub::NO_NEW_TARGET;
274 ArgumentsAccessStub::Type type; 278 ArgumentsAccessStub::Type type;
275 if (is_strict(language_mode())) { 279 if (is_strict(language_mode())) {
276 type = ArgumentsAccessStub::NEW_STRICT; 280 type = ArgumentsAccessStub::NEW_STRICT;
277 } else if (function()->has_duplicate_parameters()) { 281 } else if (function()->has_duplicate_parameters()) {
278 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 282 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
279 } else { 283 } else {
280 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 284 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
281 } 285 }
282 ArgumentsAccessStub stub(isolate(), type); 286 ArgumentsAccessStub stub(isolate(), type, has_new_target);
283 __ CallStub(&stub); 287 __ CallStub(&stub);
284 288
285 SetVar(arguments, v0, a1, a2); 289 SetVar(arguments, v0, a1, a2);
286 } 290 }
287 291
288 if (FLAG_trace) { 292 if (FLAG_trace) {
289 __ CallRuntime(Runtime::kTraceEnter, 0); 293 __ CallRuntime(Runtime::kTraceEnter, 0);
290 } 294 }
291 295
292 // Visit the declarations and body unless there is an illegal 296 // Visit the declarations and body unless there is an illegal
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 #ifdef DEBUG 436 #ifdef DEBUG
433 // Add a label for checking the size of the code used for returning. 437 // Add a label for checking the size of the code used for returning.
434 Label check_exit_codesize; 438 Label check_exit_codesize;
435 masm_->bind(&check_exit_codesize); 439 masm_->bind(&check_exit_codesize);
436 #endif 440 #endif
437 // Make sure that the constant pool is not emitted inside of the return 441 // Make sure that the constant pool is not emitted inside of the return
438 // sequence. 442 // sequence.
439 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); 443 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_);
440 // Here we use masm_-> instead of the __ macro to avoid the code coverage 444 // Here we use masm_-> instead of the __ macro to avoid the code coverage
441 // tool from instrumenting as we rely on the code size here. 445 // tool from instrumenting as we rely on the code size here.
442 int32_t sp_delta = (info_->scope()->num_parameters() + 1) * kPointerSize; 446 int32_t arg_count = info_->scope()->num_parameters() + 1;
447 if (FLAG_experimental_classes &&
448 IsSubclassConstructor(info_->function()->kind())) {
449 arg_count++;
450 }
451 int32_t sp_delta = arg_count * kPointerSize;
443 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); 452 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
444 __ RecordJSReturn(); 453 __ RecordJSReturn();
445 masm_->mov(sp, fp); 454 masm_->mov(sp, fp);
446 int no_frame_start = masm_->pc_offset(); 455 int no_frame_start = masm_->pc_offset();
447 masm_->MultiPop(static_cast<RegList>(fp.bit() | ra.bit())); 456 masm_->MultiPop(static_cast<RegList>(fp.bit() | ra.bit()));
448 masm_->Addu(sp, sp, Operand(sp_delta)); 457 masm_->Addu(sp, sp, Operand(sp_delta));
449 masm_->Jump(ra); 458 masm_->Jump(ra);
450 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); 459 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset());
451 } 460 }
452 461
(...skipping 2767 matching lines...) Expand 10 before | Expand all | Expand 10 after
3220 __ li(a3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); 3229 __ li(a3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot())));
3221 3230
3222 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 3231 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
3223 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3232 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3224 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3233 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3225 context()->Plug(v0); 3234 context()->Plug(v0);
3226 } 3235 }
3227 3236
3228 3237
3229 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3238 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3239 Comment cmnt(masm_, "[ SuperConstructorCall");
3240 Variable* new_target_var = scope()->DeclarationScope()->new_target_var();
3241 GetVar(result_register(), new_target_var);
3242 __ Push(result_register());
3243
3230 SuperReference* super_ref = expr->expression()->AsSuperReference(); 3244 SuperReference* super_ref = expr->expression()->AsSuperReference();
3231 EmitLoadSuperConstructor(super_ref); 3245 EmitLoadSuperConstructor(super_ref);
3232 __ push(result_register()); 3246 __ push(result_register());
3233 3247
3234 Variable* this_var = super_ref->this_var()->var(); 3248 Variable* this_var = super_ref->this_var()->var();
3235 3249
3236 GetVar(a0, this_var); 3250 GetVar(a0, this_var);
3237 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 3251 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3238 Label uninitialized_this; 3252 Label uninitialized_this;
3239 __ Branch(&uninitialized_this, eq, a0, Operand(at)); 3253 __ Branch(&uninitialized_this, eq, a0, Operand(at));
(...skipping 23 matching lines...) Expand all
3263 /* TODO(dslomov): support pretenuring. 3277 /* TODO(dslomov): support pretenuring.
3264 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); 3278 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot());
3265 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == 3279 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() ==
3266 expr->CallNewFeedbackSlot().ToInt() + 1); 3280 expr->CallNewFeedbackSlot().ToInt() + 1);
3267 */ 3281 */
3268 } 3282 }
3269 3283
3270 __ li(a2, FeedbackVector()); 3284 __ li(a2, FeedbackVector());
3271 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); 3285 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3272 3286
3273 // TODO(dslomov): use a different stub and propagate new.target. 3287 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3274 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
3275 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3288 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3276 3289
3290 __ Drop(1);
3291
3277 RecordJSReturnSite(expr); 3292 RecordJSReturnSite(expr);
3278 3293
3279 EmitVariableAssignment(this_var, Token::INIT_CONST); 3294 EmitVariableAssignment(this_var, Token::INIT_CONST);
3280 context()->Plug(v0); 3295 context()->Plug(v0);
3281 } 3296 }
3282 3297
3283 3298
3284 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3299 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3285 ZoneList<Expression*>* args = expr->arguments(); 3300 ZoneList<Expression*>* args = expr->arguments();
3286 DCHECK(args->length() == 1); 3301 DCHECK(args->length() == 1);
(...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after
5361 Assembler::target_address_at(pc_immediate_load_address)) == 5376 Assembler::target_address_at(pc_immediate_load_address)) ==
5362 reinterpret_cast<uint32_t>( 5377 reinterpret_cast<uint32_t>(
5363 isolate->builtins()->OsrAfterStackCheck()->entry())); 5378 isolate->builtins()->OsrAfterStackCheck()->entry()));
5364 return OSR_AFTER_STACK_CHECK; 5379 return OSR_AFTER_STACK_CHECK;
5365 } 5380 }
5366 5381
5367 5382
5368 } } // namespace v8::internal 5383 } } // namespace v8::internal
5369 5384
5370 #endif // V8_TARGET_ARCH_MIPS 5385 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698