| 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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 8 | 8 |
| 9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
| 10 // | 10 // |
| (...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2022 EmitKeyedPropertyLoad(property); | 2022 EmitKeyedPropertyLoad(property); |
| 2023 PrepareForBailoutForId(property->LoadId(), TOS_REG); | 2023 PrepareForBailoutForId(property->LoadId(), TOS_REG); |
| 2024 break; | 2024 break; |
| 2025 } | 2025 } |
| 2026 } | 2026 } |
| 2027 | 2027 |
| 2028 Token::Value op = expr->binary_op(); | 2028 Token::Value op = expr->binary_op(); |
| 2029 __ push(v0); // Left operand goes on the stack. | 2029 __ push(v0); // Left operand goes on the stack. |
| 2030 VisitForAccumulatorValue(expr->value()); | 2030 VisitForAccumulatorValue(expr->value()); |
| 2031 | 2031 |
| 2032 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() | |
| 2033 ? OVERWRITE_RIGHT | |
| 2034 : NO_OVERWRITE; | |
| 2035 SetSourcePosition(expr->position() + 1); | 2032 SetSourcePosition(expr->position() + 1); |
| 2036 AccumulatorValueContext context(this); | 2033 AccumulatorValueContext context(this); |
| 2037 if (ShouldInlineSmiCase(op)) { | 2034 if (ShouldInlineSmiCase(op)) { |
| 2038 EmitInlineSmiBinaryOp(expr->binary_operation(), | 2035 EmitInlineSmiBinaryOp(expr->binary_operation(), |
| 2039 op, | 2036 op, |
| 2040 mode, | |
| 2041 expr->target(), | 2037 expr->target(), |
| 2042 expr->value()); | 2038 expr->value()); |
| 2043 } else { | 2039 } else { |
| 2044 EmitBinaryOp(expr->binary_operation(), op, mode); | 2040 EmitBinaryOp(expr->binary_operation(), op); |
| 2045 } | 2041 } |
| 2046 | 2042 |
| 2047 // Deoptimization point in case the binary operation may have side effects. | 2043 // Deoptimization point in case the binary operation may have side effects. |
| 2048 PrepareForBailout(expr->binary_operation(), TOS_REG); | 2044 PrepareForBailout(expr->binary_operation(), TOS_REG); |
| 2049 } else { | 2045 } else { |
| 2050 VisitForAccumulatorValue(expr->value()); | 2046 VisitForAccumulatorValue(expr->value()); |
| 2051 } | 2047 } |
| 2052 | 2048 |
| 2053 // Record source position before possible IC call. | 2049 // Record source position before possible IC call. |
| 2054 SetSourcePosition(expr->position()); | 2050 SetSourcePosition(expr->position()); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2416 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2412 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
| 2417 // Stack: receiver, home_object, key. | 2413 // Stack: receiver, home_object, key. |
| 2418 SetSourcePosition(prop->position()); | 2414 SetSourcePosition(prop->position()); |
| 2419 | 2415 |
| 2420 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2416 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| 2421 } | 2417 } |
| 2422 | 2418 |
| 2423 | 2419 |
| 2424 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2420 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
| 2425 Token::Value op, | 2421 Token::Value op, |
| 2426 OverwriteMode mode, | |
| 2427 Expression* left_expr, | 2422 Expression* left_expr, |
| 2428 Expression* right_expr) { | 2423 Expression* right_expr) { |
| 2429 Label done, smi_case, stub_call; | 2424 Label done, smi_case, stub_call; |
| 2430 | 2425 |
| 2431 Register scratch1 = a2; | 2426 Register scratch1 = a2; |
| 2432 Register scratch2 = a3; | 2427 Register scratch2 = a3; |
| 2433 | 2428 |
| 2434 // Get the arguments. | 2429 // Get the arguments. |
| 2435 Register left = a1; | 2430 Register left = a1; |
| 2436 Register right = a0; | 2431 Register right = a0; |
| 2437 __ pop(left); | 2432 __ pop(left); |
| 2438 __ mov(a0, result_register()); | 2433 __ mov(a0, result_register()); |
| 2439 | 2434 |
| 2440 // Perform combined smi check on both operands. | 2435 // Perform combined smi check on both operands. |
| 2441 __ Or(scratch1, left, Operand(right)); | 2436 __ Or(scratch1, left, Operand(right)); |
| 2442 STATIC_ASSERT(kSmiTag == 0); | 2437 STATIC_ASSERT(kSmiTag == 0); |
| 2443 JumpPatchSite patch_site(masm_); | 2438 JumpPatchSite patch_site(masm_); |
| 2444 patch_site.EmitJumpIfSmi(scratch1, &smi_case); | 2439 patch_site.EmitJumpIfSmi(scratch1, &smi_case); |
| 2445 | 2440 |
| 2446 __ bind(&stub_call); | 2441 __ bind(&stub_call); |
| 2447 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); | 2442 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
| 2448 CallIC(code, expr->BinaryOperationFeedbackId()); | 2443 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2449 patch_site.EmitPatchInfo(); | 2444 patch_site.EmitPatchInfo(); |
| 2450 __ jmp(&done); | 2445 __ jmp(&done); |
| 2451 | 2446 |
| 2452 __ bind(&smi_case); | 2447 __ bind(&smi_case); |
| 2453 // Smi case. This code works the same way as the smi-smi case in the type | 2448 // Smi case. This code works the same way as the smi-smi case in the type |
| 2454 // recording binary operation stub, see | 2449 // recording binary operation stub, see |
| 2455 switch (op) { | 2450 switch (op) { |
| 2456 case Token::SAR: | 2451 case Token::SAR: |
| 2457 __ GetLeastBitsFromSmi(scratch1, right, 5); | 2452 __ GetLeastBitsFromSmi(scratch1, right, 5); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2567 } | 2562 } |
| 2568 | 2563 |
| 2569 // prototype | 2564 // prototype |
| 2570 __ CallRuntime(Runtime::kToFastProperties, 1); | 2565 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2571 | 2566 |
| 2572 // constructor | 2567 // constructor |
| 2573 __ CallRuntime(Runtime::kToFastProperties, 1); | 2568 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2574 } | 2569 } |
| 2575 | 2570 |
| 2576 | 2571 |
| 2577 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 2572 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
| 2578 Token::Value op, | |
| 2579 OverwriteMode mode) { | |
| 2580 __ mov(a0, result_register()); | 2573 __ mov(a0, result_register()); |
| 2581 __ pop(a1); | 2574 __ pop(a1); |
| 2582 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); | 2575 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
| 2583 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2576 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2584 CallIC(code, expr->BinaryOperationFeedbackId()); | 2577 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2585 patch_site.EmitPatchInfo(); | 2578 patch_site.EmitPatchInfo(); |
| 2586 context()->Plug(v0); | 2579 context()->Plug(v0); |
| 2587 } | 2580 } |
| 2588 | 2581 |
| 2589 | 2582 |
| 2590 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2583 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
| 2591 DCHECK(expr->IsValidReferenceExpression()); | 2584 DCHECK(expr->IsValidReferenceExpression()); |
| 2592 | 2585 |
| (...skipping 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4843 } | 4836 } |
| 4844 } | 4837 } |
| 4845 | 4838 |
| 4846 __ bind(&stub_call); | 4839 __ bind(&stub_call); |
| 4847 __ mov(a1, v0); | 4840 __ mov(a1, v0); |
| 4848 __ li(a0, Operand(Smi::FromInt(count_value))); | 4841 __ li(a0, Operand(Smi::FromInt(count_value))); |
| 4849 | 4842 |
| 4850 // Record position before stub call. | 4843 // Record position before stub call. |
| 4851 SetSourcePosition(expr->position()); | 4844 SetSourcePosition(expr->position()); |
| 4852 | 4845 |
| 4853 Handle<Code> code = | 4846 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), Token::ADD).code(); |
| 4854 CodeFactory::BinaryOpIC(isolate(), Token::ADD, NO_OVERWRITE).code(); | |
| 4855 CallIC(code, expr->CountBinOpFeedbackId()); | 4847 CallIC(code, expr->CountBinOpFeedbackId()); |
| 4856 patch_site.EmitPatchInfo(); | 4848 patch_site.EmitPatchInfo(); |
| 4857 __ bind(&done); | 4849 __ bind(&done); |
| 4858 | 4850 |
| 4859 // Store the value returned in v0. | 4851 // Store the value returned in v0. |
| 4860 switch (assign_type) { | 4852 switch (assign_type) { |
| 4861 case VARIABLE: | 4853 case VARIABLE: |
| 4862 if (expr->is_postfix()) { | 4854 if (expr->is_postfix()) { |
| 4863 { EffectContext context(this); | 4855 { EffectContext context(this); |
| 4864 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 4856 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5372 Assembler::target_address_at(pc_immediate_load_address)) == | 5364 Assembler::target_address_at(pc_immediate_load_address)) == |
| 5373 reinterpret_cast<uint32_t>( | 5365 reinterpret_cast<uint32_t>( |
| 5374 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5366 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 5375 return OSR_AFTER_STACK_CHECK; | 5367 return OSR_AFTER_STACK_CHECK; |
| 5376 } | 5368 } |
| 5377 | 5369 |
| 5378 | 5370 |
| 5379 } } // namespace v8::internal | 5371 } } // namespace v8::internal |
| 5380 | 5372 |
| 5381 #endif // V8_TARGET_ARCH_MIPS | 5373 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |