| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { | 334 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { |
| 335 __ li(a2, Operand(profiling_counter_)); | 335 __ li(a2, Operand(profiling_counter_)); |
| 336 __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset)); | 336 __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset)); |
| 337 __ Subu(a3, a3, Operand(Smi::FromInt(delta))); | 337 __ Subu(a3, a3, Operand(Smi::FromInt(delta))); |
| 338 __ sw(a3, FieldMemOperand(a2, Cell::kValueOffset)); | 338 __ sw(a3, FieldMemOperand(a2, Cell::kValueOffset)); |
| 339 } | 339 } |
| 340 | 340 |
| 341 | 341 |
| 342 void FullCodeGenerator::EmitProfilingCounterReset() { | 342 void FullCodeGenerator::EmitProfilingCounterReset() { |
| 343 int reset_value = FLAG_interrupt_budget; | 343 int reset_value = FLAG_interrupt_budget; |
| 344 if (info_->ShouldSelfOptimize() && !FLAG_retry_self_opt) { | |
| 345 // Self-optimization is a one-off thing: if it fails, don't try again. | |
| 346 reset_value = Smi::kMaxValue; | |
| 347 } | |
| 348 if (isolate()->IsDebuggerActive()) { | 344 if (isolate()->IsDebuggerActive()) { |
| 349 // Detect debug break requests as soon as possible. | 345 // Detect debug break requests as soon as possible. |
| 350 reset_value = FLAG_interrupt_budget >> 4; | 346 reset_value = FLAG_interrupt_budget >> 4; |
| 351 } | 347 } |
| 352 __ li(a2, Operand(profiling_counter_)); | 348 __ li(a2, Operand(profiling_counter_)); |
| 353 __ li(a3, Operand(Smi::FromInt(reset_value))); | 349 __ li(a3, Operand(Smi::FromInt(reset_value))); |
| 354 __ sw(a3, FieldMemOperand(a2, Cell::kValueOffset)); | 350 __ sw(a3, FieldMemOperand(a2, Cell::kValueOffset)); |
| 355 } | 351 } |
| 356 | 352 |
| 357 | 353 |
| 358 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, | 354 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, |
| 359 Label* back_edge_target) { | 355 Label* back_edge_target) { |
| 360 // The generated code is used in Deoptimizer::PatchStackCheckCodeAt so we need | 356 // The generated code is used in Deoptimizer::PatchStackCheckCodeAt so we need |
| 361 // to make sure it is constant. Branch may emit a skip-or-jump sequence | 357 // to make sure it is constant. Branch may emit a skip-or-jump sequence |
| 362 // instead of the normal Branch. It seems that the "skip" part of that | 358 // instead of the normal Branch. It seems that the "skip" part of that |
| 363 // sequence is about as long as this Branch would be so it is safe to ignore | 359 // sequence is about as long as this Branch would be so it is safe to ignore |
| 364 // that. | 360 // that. |
| 365 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 361 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
| 366 Comment cmnt(masm_, "[ Back edge bookkeeping"); | 362 Comment cmnt(masm_, "[ Back edge bookkeeping"); |
| 367 Label ok; | 363 Label ok; |
| 368 int weight = 1; | 364 ASSERT(back_edge_target->is_bound()); |
| 369 if (FLAG_weighted_back_edges) { | 365 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); |
| 370 ASSERT(back_edge_target->is_bound()); | 366 int weight = Min(kMaxBackEdgeWeight, |
| 371 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); | 367 Max(1, distance / kCodeSizeMultiplier)); |
| 372 weight = Min(kMaxBackEdgeWeight, | |
| 373 Max(1, distance / kCodeSizeMultiplier)); | |
| 374 } | |
| 375 EmitProfilingCounterDecrement(weight); | 368 EmitProfilingCounterDecrement(weight); |
| 376 __ slt(at, a3, zero_reg); | 369 __ slt(at, a3, zero_reg); |
| 377 __ beq(at, zero_reg, &ok); | 370 __ beq(at, zero_reg, &ok); |
| 378 // Call will emit a li t9 first, so it is safe to use the delay slot. | 371 // Call will emit a li t9 first, so it is safe to use the delay slot. |
| 379 __ Call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); | 372 __ Call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); |
| 380 // Record a mapping of this PC offset to the OSR id. This is used to find | 373 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 381 // the AST id from the unoptimized code in order to use it as a key into | 374 // the AST id from the unoptimized code in order to use it as a key into |
| 382 // the deoptimization input data found in the optimized code. | 375 // the deoptimization input data found in the optimized code. |
| 383 RecordBackEdge(stmt->OsrEntryId()); | 376 RecordBackEdge(stmt->OsrEntryId()); |
| 384 EmitProfilingCounterReset(); | 377 EmitProfilingCounterReset(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 397 if (return_label_.is_bound()) { | 390 if (return_label_.is_bound()) { |
| 398 __ Branch(&return_label_); | 391 __ Branch(&return_label_); |
| 399 } else { | 392 } else { |
| 400 __ bind(&return_label_); | 393 __ bind(&return_label_); |
| 401 if (FLAG_trace) { | 394 if (FLAG_trace) { |
| 402 // Push the return value on the stack as the parameter. | 395 // Push the return value on the stack as the parameter. |
| 403 // Runtime::TraceExit returns its parameter in v0. | 396 // Runtime::TraceExit returns its parameter in v0. |
| 404 __ push(v0); | 397 __ push(v0); |
| 405 __ CallRuntime(Runtime::kTraceExit, 1); | 398 __ CallRuntime(Runtime::kTraceExit, 1); |
| 406 } | 399 } |
| 407 if (FLAG_interrupt_at_exit || FLAG_self_optimization) { | 400 // Pretend that the exit is a backwards jump to the entry. |
| 408 // Pretend that the exit is a backwards jump to the entry. | 401 int weight = 1; |
| 409 int weight = 1; | 402 if (info_->ShouldSelfOptimize()) { |
| 410 if (info_->ShouldSelfOptimize()) { | 403 weight = FLAG_interrupt_budget / FLAG_self_opt_count; |
| 411 weight = FLAG_interrupt_budget / FLAG_self_opt_count; | 404 } else { |
| 412 } else if (FLAG_weighted_back_edges) { | 405 int distance = masm_->pc_offset(); |
| 413 int distance = masm_->pc_offset(); | 406 weight = Min(kMaxBackEdgeWeight, |
| 414 weight = Min(kMaxBackEdgeWeight, | 407 Max(1, distance / kCodeSizeMultiplier)); |
| 415 Max(1, distance / kCodeSizeMultiplier)); | |
| 416 } | |
| 417 EmitProfilingCounterDecrement(weight); | |
| 418 Label ok; | |
| 419 __ Branch(&ok, ge, a3, Operand(zero_reg)); | |
| 420 __ push(v0); | |
| 421 if (info_->ShouldSelfOptimize() && FLAG_direct_self_opt) { | |
| 422 __ lw(a2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | |
| 423 __ push(a2); | |
| 424 __ CallRuntime(Runtime::kOptimizeFunctionOnNextCall, 1); | |
| 425 } else { | |
| 426 __ Call(isolate()->builtins()->InterruptCheck(), | |
| 427 RelocInfo::CODE_TARGET); | |
| 428 } | |
| 429 __ pop(v0); | |
| 430 EmitProfilingCounterReset(); | |
| 431 __ bind(&ok); | |
| 432 } | 408 } |
| 409 EmitProfilingCounterDecrement(weight); |
| 410 Label ok; |
| 411 __ Branch(&ok, ge, a3, Operand(zero_reg)); |
| 412 __ push(v0); |
| 413 __ Call(isolate()->builtins()->InterruptCheck(), |
| 414 RelocInfo::CODE_TARGET); |
| 415 __ pop(v0); |
| 416 EmitProfilingCounterReset(); |
| 417 __ bind(&ok); |
| 433 | 418 |
| 434 #ifdef DEBUG | 419 #ifdef DEBUG |
| 435 // Add a label for checking the size of the code used for returning. | 420 // Add a label for checking the size of the code used for returning. |
| 436 Label check_exit_codesize; | 421 Label check_exit_codesize; |
| 437 masm_->bind(&check_exit_codesize); | 422 masm_->bind(&check_exit_codesize); |
| 438 #endif | 423 #endif |
| 439 // Make sure that the constant pool is not emitted inside of the return | 424 // Make sure that the constant pool is not emitted inside of the return |
| 440 // sequence. | 425 // sequence. |
| 441 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 426 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
| 442 // Here we use masm_-> instead of the __ macro to avoid the code coverage | 427 // Here we use masm_-> instead of the __ macro to avoid the code coverage |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 __ bind(&done); | 609 __ bind(&done); |
| 625 } | 610 } |
| 626 | 611 |
| 627 | 612 |
| 628 void FullCodeGenerator::StackValueContext::Plug( | 613 void FullCodeGenerator::StackValueContext::Plug( |
| 629 Label* materialize_true, | 614 Label* materialize_true, |
| 630 Label* materialize_false) const { | 615 Label* materialize_false) const { |
| 631 Label done; | 616 Label done; |
| 632 __ bind(materialize_true); | 617 __ bind(materialize_true); |
| 633 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 618 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
| 619 // Push the value as the following branch can clobber at in long branch mode. |
| 620 __ push(at); |
| 634 __ Branch(&done); | 621 __ Branch(&done); |
| 635 __ bind(materialize_false); | 622 __ bind(materialize_false); |
| 636 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 623 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
| 624 __ push(at); |
| 637 __ bind(&done); | 625 __ bind(&done); |
| 638 __ push(at); | |
| 639 } | 626 } |
| 640 | 627 |
| 641 | 628 |
| 642 void FullCodeGenerator::TestContext::Plug(Label* materialize_true, | 629 void FullCodeGenerator::TestContext::Plug(Label* materialize_true, |
| 643 Label* materialize_false) const { | 630 Label* materialize_false) const { |
| 644 ASSERT(materialize_true == true_label_); | 631 ASSERT(materialize_true == true_label_); |
| 645 ASSERT(materialize_false == false_label_); | 632 ASSERT(materialize_false == false_label_); |
| 646 } | 633 } |
| 647 | 634 |
| 648 | 635 |
| (...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 } else { | 1760 } else { |
| 1774 context()->Plug(v0); | 1761 context()->Plug(v0); |
| 1775 } | 1762 } |
| 1776 } | 1763 } |
| 1777 | 1764 |
| 1778 | 1765 |
| 1779 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { | 1766 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
| 1780 Comment cmnt(masm_, "[ ArrayLiteral"); | 1767 Comment cmnt(masm_, "[ ArrayLiteral"); |
| 1781 | 1768 |
| 1782 expr->BuildConstantElements(isolate()); | 1769 expr->BuildConstantElements(isolate()); |
| 1770 int flags = expr->depth() == 1 |
| 1771 ? ArrayLiteral::kShallowElements |
| 1772 : ArrayLiteral::kNoFlags; |
| 1773 |
| 1783 ZoneList<Expression*>* subexprs = expr->values(); | 1774 ZoneList<Expression*>* subexprs = expr->values(); |
| 1784 int length = subexprs->length(); | 1775 int length = subexprs->length(); |
| 1785 | 1776 |
| 1786 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1777 Handle<FixedArray> constant_elements = expr->constant_elements(); |
| 1787 ASSERT_EQ(2, constant_elements->length()); | 1778 ASSERT_EQ(2, constant_elements->length()); |
| 1788 ElementsKind constant_elements_kind = | 1779 ElementsKind constant_elements_kind = |
| 1789 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); | 1780 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
| 1790 bool has_fast_elements = | 1781 bool has_fast_elements = |
| 1791 IsFastObjectElementsKind(constant_elements_kind); | 1782 IsFastObjectElementsKind(constant_elements_kind); |
| 1792 Handle<FixedArrayBase> constant_elements_values( | 1783 Handle<FixedArrayBase> constant_elements_values( |
| 1793 FixedArrayBase::cast(constant_elements->get(1))); | 1784 FixedArrayBase::cast(constant_elements->get(1))); |
| 1794 | 1785 |
| 1786 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites |
| 1787 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; |
| 1788 if (has_fast_elements && !FLAG_allocation_site_pretenuring) { |
| 1789 // If the only customer of allocation sites is transitioning, then |
| 1790 // we can turn it off if we don't have anywhere else to transition to. |
| 1791 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 1792 } |
| 1793 |
| 1795 __ mov(a0, result_register()); | 1794 __ mov(a0, result_register()); |
| 1796 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1795 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1797 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); | 1796 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); |
| 1798 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); | 1797 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); |
| 1799 __ li(a1, Operand(constant_elements)); | 1798 __ li(a1, Operand(constant_elements)); |
| 1800 if (has_fast_elements && constant_elements_values->map() == | 1799 if (has_fast_elements && constant_elements_values->map() == |
| 1801 isolate()->heap()->fixed_cow_array_map()) { | 1800 isolate()->heap()->fixed_cow_array_map()) { |
| 1802 FastCloneShallowArrayStub stub( | 1801 FastCloneShallowArrayStub stub( |
| 1803 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1802 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
| 1804 DONT_TRACK_ALLOCATION_SITE, | 1803 allocation_site_mode, |
| 1805 length); | 1804 length); |
| 1806 __ CallStub(&stub); | 1805 __ CallStub(&stub); |
| 1807 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), | 1806 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), |
| 1808 1, a1, a2); | 1807 1, a1, a2); |
| 1809 } else if (expr->depth() > 1 || Serializer::enabled() || | 1808 } else if (expr->depth() > 1 || Serializer::enabled() || |
| 1810 length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1809 length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| 1811 __ Push(a3, a2, a1); | 1810 __ li(a0, Operand(Smi::FromInt(flags))); |
| 1812 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1811 __ Push(a3, a2, a1, a0); |
| 1812 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
| 1813 } else { | 1813 } else { |
| 1814 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1814 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
| 1815 FLAG_smi_only_arrays); | 1815 FLAG_smi_only_arrays); |
| 1816 FastCloneShallowArrayStub::Mode mode = | 1816 FastCloneShallowArrayStub::Mode mode = |
| 1817 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1817 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
| 1818 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites | |
| 1819 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; | |
| 1820 | 1818 |
| 1821 if (has_fast_elements) { | 1819 if (has_fast_elements) { |
| 1822 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; | 1820 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 1823 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | |
| 1824 } | 1821 } |
| 1825 | 1822 |
| 1826 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 1823 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
| 1827 __ CallStub(&stub); | 1824 __ CallStub(&stub); |
| 1828 } | 1825 } |
| 1829 | 1826 |
| 1830 bool result_saved = false; // Is the result saved to the stack? | 1827 bool result_saved = false; // Is the result saved to the stack? |
| 1831 | 1828 |
| 1832 // Emit code to evaluate all the non-constant subexpressions and to store | 1829 // Emit code to evaluate all the non-constant subexpressions and to store |
| 1833 // them into the newly cloned array. | 1830 // them into the newly cloned array. |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2300 __ pop(left); | 2297 __ pop(left); |
| 2301 __ mov(a0, result_register()); | 2298 __ mov(a0, result_register()); |
| 2302 | 2299 |
| 2303 // Perform combined smi check on both operands. | 2300 // Perform combined smi check on both operands. |
| 2304 __ Or(scratch1, left, Operand(right)); | 2301 __ Or(scratch1, left, Operand(right)); |
| 2305 STATIC_ASSERT(kSmiTag == 0); | 2302 STATIC_ASSERT(kSmiTag == 0); |
| 2306 JumpPatchSite patch_site(masm_); | 2303 JumpPatchSite patch_site(masm_); |
| 2307 patch_site.EmitJumpIfSmi(scratch1, &smi_case); | 2304 patch_site.EmitJumpIfSmi(scratch1, &smi_case); |
| 2308 | 2305 |
| 2309 __ bind(&stub_call); | 2306 __ bind(&stub_call); |
| 2310 BinaryOpStub stub(op, mode); | 2307 BinaryOpICStub stub(op, mode); |
| 2311 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, | 2308 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
| 2312 expr->BinaryOperationFeedbackId()); | 2309 expr->BinaryOperationFeedbackId()); |
| 2313 patch_site.EmitPatchInfo(); | 2310 patch_site.EmitPatchInfo(); |
| 2314 __ jmp(&done); | 2311 __ jmp(&done); |
| 2315 | 2312 |
| 2316 __ bind(&smi_case); | 2313 __ bind(&smi_case); |
| 2317 // Smi case. This code works the same way as the smi-smi case in the type | 2314 // Smi case. This code works the same way as the smi-smi case in the type |
| 2318 // recording binary operation stub, see | 2315 // recording binary operation stub, see |
| 2319 // BinaryOpStub::GenerateSmiSmiOperation for comments. | |
| 2320 switch (op) { | 2316 switch (op) { |
| 2321 case Token::SAR: | 2317 case Token::SAR: |
| 2322 __ Branch(&stub_call); | 2318 __ Branch(&stub_call); |
| 2323 __ GetLeastBitsFromSmi(scratch1, right, 5); | 2319 __ GetLeastBitsFromSmi(scratch1, right, 5); |
| 2324 __ srav(right, left, scratch1); | 2320 __ srav(right, left, scratch1); |
| 2325 __ And(v0, right, Operand(~kSmiTagMask)); | 2321 __ And(v0, right, Operand(~kSmiTagMask)); |
| 2326 break; | 2322 break; |
| 2327 case Token::SHL: { | 2323 case Token::SHL: { |
| 2328 __ Branch(&stub_call); | 2324 __ Branch(&stub_call); |
| 2329 __ SmiUntag(scratch1, left); | 2325 __ SmiUntag(scratch1, left); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2383 __ bind(&done); | 2379 __ bind(&done); |
| 2384 context()->Plug(v0); | 2380 context()->Plug(v0); |
| 2385 } | 2381 } |
| 2386 | 2382 |
| 2387 | 2383 |
| 2388 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 2384 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
| 2389 Token::Value op, | 2385 Token::Value op, |
| 2390 OverwriteMode mode) { | 2386 OverwriteMode mode) { |
| 2391 __ mov(a0, result_register()); | 2387 __ mov(a0, result_register()); |
| 2392 __ pop(a1); | 2388 __ pop(a1); |
| 2393 BinaryOpStub stub(op, mode); | 2389 BinaryOpICStub stub(op, mode); |
| 2394 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2390 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2395 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, | 2391 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
| 2396 expr->BinaryOperationFeedbackId()); | 2392 expr->BinaryOperationFeedbackId()); |
| 2397 patch_site.EmitPatchInfo(); | 2393 patch_site.EmitPatchInfo(); |
| 2398 context()->Plug(v0); | 2394 context()->Plug(v0); |
| 2399 } | 2395 } |
| 2400 | 2396 |
| 2401 | 2397 |
| 2402 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2398 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
| 2403 // Invalid left-hand sides are rewritten by the parser to have a 'throw | 2399 // Invalid left-hand sides are rewritten by the parser to have a 'throw |
| (...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3717 | 3713 |
| 3718 | 3714 |
| 3719 void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) { | 3715 void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) { |
| 3720 ZoneList<Expression*>* args = expr->arguments(); | 3716 ZoneList<Expression*>* args = expr->arguments(); |
| 3721 ASSERT_EQ(2, args->length()); | 3717 ASSERT_EQ(2, args->length()); |
| 3722 if (FLAG_new_string_add) { | 3718 if (FLAG_new_string_add) { |
| 3723 VisitForStackValue(args->at(0)); | 3719 VisitForStackValue(args->at(0)); |
| 3724 VisitForAccumulatorValue(args->at(1)); | 3720 VisitForAccumulatorValue(args->at(1)); |
| 3725 | 3721 |
| 3726 __ pop(a1); | 3722 __ pop(a1); |
| 3723 __ mov(a0, result_register()); // NewStringAddStub requires args in a0, a1. |
| 3727 NewStringAddStub stub(STRING_ADD_CHECK_BOTH, NOT_TENURED); | 3724 NewStringAddStub stub(STRING_ADD_CHECK_BOTH, NOT_TENURED); |
| 3728 __ CallStub(&stub); | 3725 __ CallStub(&stub); |
| 3729 } else { | 3726 } else { |
| 3730 VisitForStackValue(args->at(0)); | 3727 VisitForStackValue(args->at(0)); |
| 3731 VisitForStackValue(args->at(1)); | 3728 VisitForStackValue(args->at(1)); |
| 3732 | 3729 |
| 3733 StringAddStub stub(STRING_ADD_CHECK_BOTH); | 3730 StringAddStub stub(STRING_ADD_CHECK_BOTH); |
| 3734 __ CallStub(&stub); | 3731 __ CallStub(&stub); |
| 3735 } | 3732 } |
| 3736 context()->Plug(v0); | 3733 context()->Plug(v0); |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4454 } | 4451 } |
| 4455 } | 4452 } |
| 4456 | 4453 |
| 4457 __ bind(&stub_call); | 4454 __ bind(&stub_call); |
| 4458 __ mov(a1, v0); | 4455 __ mov(a1, v0); |
| 4459 __ li(a0, Operand(Smi::FromInt(count_value))); | 4456 __ li(a0, Operand(Smi::FromInt(count_value))); |
| 4460 | 4457 |
| 4461 // Record position before stub call. | 4458 // Record position before stub call. |
| 4462 SetSourcePosition(expr->position()); | 4459 SetSourcePosition(expr->position()); |
| 4463 | 4460 |
| 4464 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); | 4461 BinaryOpICStub stub(Token::ADD, NO_OVERWRITE); |
| 4465 CallIC(stub.GetCode(isolate()), | 4462 CallIC(stub.GetCode(isolate()), |
| 4466 RelocInfo::CODE_TARGET, | 4463 RelocInfo::CODE_TARGET, |
| 4467 expr->CountBinOpFeedbackId()); | 4464 expr->CountBinOpFeedbackId()); |
| 4468 patch_site.EmitPatchInfo(); | 4465 patch_site.EmitPatchInfo(); |
| 4469 __ bind(&done); | 4466 __ bind(&done); |
| 4470 | 4467 |
| 4471 // Store the value returned in v0. | 4468 // Store the value returned in v0. |
| 4472 switch (assign_type) { | 4469 switch (assign_type) { |
| 4473 case VARIABLE: | 4470 case VARIABLE: |
| 4474 if (expr->is_postfix()) { | 4471 if (expr->is_postfix()) { |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4965 Assembler::target_address_at(pc_immediate_load_address)) == | 4962 Assembler::target_address_at(pc_immediate_load_address)) == |
| 4966 reinterpret_cast<uint32_t>( | 4963 reinterpret_cast<uint32_t>( |
| 4967 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4964 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 4968 return OSR_AFTER_STACK_CHECK; | 4965 return OSR_AFTER_STACK_CHECK; |
| 4969 } | 4966 } |
| 4970 | 4967 |
| 4971 | 4968 |
| 4972 } } // namespace v8::internal | 4969 } } // namespace v8::internal |
| 4973 | 4970 |
| 4974 #endif // V8_TARGET_ARCH_MIPS | 4971 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |