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