| 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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 __ bind(&done); | 624 __ bind(&done); |
| 625 } | 625 } |
| 626 | 626 |
| 627 | 627 |
| 628 void FullCodeGenerator::StackValueContext::Plug( | 628 void FullCodeGenerator::StackValueContext::Plug( |
| 629 Label* materialize_true, | 629 Label* materialize_true, |
| 630 Label* materialize_false) const { | 630 Label* materialize_false) const { |
| 631 Label done; | 631 Label done; |
| 632 __ bind(materialize_true); | 632 __ bind(materialize_true); |
| 633 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 633 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
| 634 // Push the value as the following branch can clobber at in long branch mode. |
| 635 __ push(at); |
| 634 __ Branch(&done); | 636 __ Branch(&done); |
| 635 __ bind(materialize_false); | 637 __ bind(materialize_false); |
| 636 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 638 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
| 639 __ push(at); |
| 637 __ bind(&done); | 640 __ bind(&done); |
| 638 __ push(at); | |
| 639 } | 641 } |
| 640 | 642 |
| 641 | 643 |
| 642 void FullCodeGenerator::TestContext::Plug(Label* materialize_true, | 644 void FullCodeGenerator::TestContext::Plug(Label* materialize_true, |
| 643 Label* materialize_false) const { | 645 Label* materialize_false) const { |
| 644 ASSERT(materialize_true == true_label_); | 646 ASSERT(materialize_true == true_label_); |
| 645 ASSERT(materialize_false == false_label_); | 647 ASSERT(materialize_false == false_label_); |
| 646 } | 648 } |
| 647 | 649 |
| 648 | 650 |
| (...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2310 __ pop(left); | 2312 __ pop(left); |
| 2311 __ mov(a0, result_register()); | 2313 __ mov(a0, result_register()); |
| 2312 | 2314 |
| 2313 // Perform combined smi check on both operands. | 2315 // Perform combined smi check on both operands. |
| 2314 __ Or(scratch1, left, Operand(right)); | 2316 __ Or(scratch1, left, Operand(right)); |
| 2315 STATIC_ASSERT(kSmiTag == 0); | 2317 STATIC_ASSERT(kSmiTag == 0); |
| 2316 JumpPatchSite patch_site(masm_); | 2318 JumpPatchSite patch_site(masm_); |
| 2317 patch_site.EmitJumpIfSmi(scratch1, &smi_case); | 2319 patch_site.EmitJumpIfSmi(scratch1, &smi_case); |
| 2318 | 2320 |
| 2319 __ bind(&stub_call); | 2321 __ bind(&stub_call); |
| 2320 BinaryOpStub stub(op, mode); | 2322 BinaryOpICStub stub(op, mode); |
| 2321 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, | 2323 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
| 2322 expr->BinaryOperationFeedbackId()); | 2324 expr->BinaryOperationFeedbackId()); |
| 2323 patch_site.EmitPatchInfo(); | 2325 patch_site.EmitPatchInfo(); |
| 2324 __ jmp(&done); | 2326 __ jmp(&done); |
| 2325 | 2327 |
| 2326 __ bind(&smi_case); | 2328 __ bind(&smi_case); |
| 2327 // Smi case. This code works the same way as the smi-smi case in the type | 2329 // Smi case. This code works the same way as the smi-smi case in the type |
| 2328 // recording binary operation stub, see | 2330 // recording binary operation stub, see |
| 2329 // BinaryOpStub::GenerateSmiSmiOperation for comments. | |
| 2330 switch (op) { | 2331 switch (op) { |
| 2331 case Token::SAR: | 2332 case Token::SAR: |
| 2332 __ Branch(&stub_call); | 2333 __ Branch(&stub_call); |
| 2333 __ GetLeastBitsFromSmi(scratch1, right, 5); | 2334 __ GetLeastBitsFromSmi(scratch1, right, 5); |
| 2334 __ srav(right, left, scratch1); | 2335 __ srav(right, left, scratch1); |
| 2335 __ And(v0, right, Operand(~kSmiTagMask)); | 2336 __ And(v0, right, Operand(~kSmiTagMask)); |
| 2336 break; | 2337 break; |
| 2337 case Token::SHL: { | 2338 case Token::SHL: { |
| 2338 __ Branch(&stub_call); | 2339 __ Branch(&stub_call); |
| 2339 __ SmiUntag(scratch1, left); | 2340 __ SmiUntag(scratch1, left); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2393 __ bind(&done); | 2394 __ bind(&done); |
| 2394 context()->Plug(v0); | 2395 context()->Plug(v0); |
| 2395 } | 2396 } |
| 2396 | 2397 |
| 2397 | 2398 |
| 2398 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 2399 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
| 2399 Token::Value op, | 2400 Token::Value op, |
| 2400 OverwriteMode mode) { | 2401 OverwriteMode mode) { |
| 2401 __ mov(a0, result_register()); | 2402 __ mov(a0, result_register()); |
| 2402 __ pop(a1); | 2403 __ pop(a1); |
| 2403 BinaryOpStub stub(op, mode); | 2404 BinaryOpICStub stub(op, mode); |
| 2404 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2405 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2405 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, | 2406 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
| 2406 expr->BinaryOperationFeedbackId()); | 2407 expr->BinaryOperationFeedbackId()); |
| 2407 patch_site.EmitPatchInfo(); | 2408 patch_site.EmitPatchInfo(); |
| 2408 context()->Plug(v0); | 2409 context()->Plug(v0); |
| 2409 } | 2410 } |
| 2410 | 2411 |
| 2411 | 2412 |
| 2412 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2413 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
| 2413 // Invalid left-hand sides are rewritten by the parser to have a 'throw | 2414 // 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... |
| 3727 | 3728 |
| 3728 | 3729 |
| 3729 void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) { | 3730 void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) { |
| 3730 ZoneList<Expression*>* args = expr->arguments(); | 3731 ZoneList<Expression*>* args = expr->arguments(); |
| 3731 ASSERT_EQ(2, args->length()); | 3732 ASSERT_EQ(2, args->length()); |
| 3732 if (FLAG_new_string_add) { | 3733 if (FLAG_new_string_add) { |
| 3733 VisitForStackValue(args->at(0)); | 3734 VisitForStackValue(args->at(0)); |
| 3734 VisitForAccumulatorValue(args->at(1)); | 3735 VisitForAccumulatorValue(args->at(1)); |
| 3735 | 3736 |
| 3736 __ pop(a1); | 3737 __ pop(a1); |
| 3738 __ mov(a0, result_register()); // NewStringAddStub requires args in a0, a1. |
| 3737 NewStringAddStub stub(STRING_ADD_CHECK_BOTH, NOT_TENURED); | 3739 NewStringAddStub stub(STRING_ADD_CHECK_BOTH, NOT_TENURED); |
| 3738 __ CallStub(&stub); | 3740 __ CallStub(&stub); |
| 3739 } else { | 3741 } else { |
| 3740 VisitForStackValue(args->at(0)); | 3742 VisitForStackValue(args->at(0)); |
| 3741 VisitForStackValue(args->at(1)); | 3743 VisitForStackValue(args->at(1)); |
| 3742 | 3744 |
| 3743 StringAddStub stub(STRING_ADD_CHECK_BOTH); | 3745 StringAddStub stub(STRING_ADD_CHECK_BOTH); |
| 3744 __ CallStub(&stub); | 3746 __ CallStub(&stub); |
| 3745 } | 3747 } |
| 3746 context()->Plug(v0); | 3748 context()->Plug(v0); |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4464 } | 4466 } |
| 4465 } | 4467 } |
| 4466 | 4468 |
| 4467 __ bind(&stub_call); | 4469 __ bind(&stub_call); |
| 4468 __ mov(a1, v0); | 4470 __ mov(a1, v0); |
| 4469 __ li(a0, Operand(Smi::FromInt(count_value))); | 4471 __ li(a0, Operand(Smi::FromInt(count_value))); |
| 4470 | 4472 |
| 4471 // Record position before stub call. | 4473 // Record position before stub call. |
| 4472 SetSourcePosition(expr->position()); | 4474 SetSourcePosition(expr->position()); |
| 4473 | 4475 |
| 4474 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); | 4476 BinaryOpICStub stub(Token::ADD, NO_OVERWRITE); |
| 4475 CallIC(stub.GetCode(isolate()), | 4477 CallIC(stub.GetCode(isolate()), |
| 4476 RelocInfo::CODE_TARGET, | 4478 RelocInfo::CODE_TARGET, |
| 4477 expr->CountBinOpFeedbackId()); | 4479 expr->CountBinOpFeedbackId()); |
| 4478 patch_site.EmitPatchInfo(); | 4480 patch_site.EmitPatchInfo(); |
| 4479 __ bind(&done); | 4481 __ bind(&done); |
| 4480 | 4482 |
| 4481 // Store the value returned in v0. | 4483 // Store the value returned in v0. |
| 4482 switch (assign_type) { | 4484 switch (assign_type) { |
| 4483 case VARIABLE: | 4485 case VARIABLE: |
| 4484 if (expr->is_postfix()) { | 4486 if (expr->is_postfix()) { |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4975 Assembler::target_address_at(pc_immediate_load_address)) == | 4977 Assembler::target_address_at(pc_immediate_load_address)) == |
| 4976 reinterpret_cast<uint32_t>( | 4978 reinterpret_cast<uint32_t>( |
| 4977 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4979 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 4978 return OSR_AFTER_STACK_CHECK; | 4980 return OSR_AFTER_STACK_CHECK; |
| 4979 } | 4981 } |
| 4980 | 4982 |
| 4981 | 4983 |
| 4982 } } // namespace v8::internal | 4984 } } // namespace v8::internal |
| 4983 | 4985 |
| 4984 #endif // V8_TARGET_ARCH_MIPS | 4986 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |