| 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 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2019 EmitKeyedPropertyLoad(property); | 2019 EmitKeyedPropertyLoad(property); |
| 2020 PrepareForBailoutForId(property->LoadId(), TOS_REG); | 2020 PrepareForBailoutForId(property->LoadId(), TOS_REG); |
| 2021 break; | 2021 break; |
| 2022 } | 2022 } |
| 2023 } | 2023 } |
| 2024 | 2024 |
| 2025 Token::Value op = expr->binary_op(); | 2025 Token::Value op = expr->binary_op(); |
| 2026 __ push(v0); // Left operand goes on the stack. | 2026 __ push(v0); // Left operand goes on the stack. |
| 2027 VisitForAccumulatorValue(expr->value()); | 2027 VisitForAccumulatorValue(expr->value()); |
| 2028 | 2028 |
| 2029 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() | |
| 2030 ? OVERWRITE_RIGHT | |
| 2031 : NO_OVERWRITE; | |
| 2032 SetSourcePosition(expr->position() + 1); | 2029 SetSourcePosition(expr->position() + 1); |
| 2033 AccumulatorValueContext context(this); | 2030 AccumulatorValueContext context(this); |
| 2034 if (ShouldInlineSmiCase(op)) { | 2031 if (ShouldInlineSmiCase(op)) { |
| 2035 EmitInlineSmiBinaryOp(expr->binary_operation(), | 2032 EmitInlineSmiBinaryOp(expr->binary_operation(), |
| 2036 op, | 2033 op, |
| 2037 mode, | |
| 2038 expr->target(), | 2034 expr->target(), |
| 2039 expr->value()); | 2035 expr->value()); |
| 2040 } else { | 2036 } else { |
| 2041 EmitBinaryOp(expr->binary_operation(), op, mode); | 2037 EmitBinaryOp(expr->binary_operation(), op); |
| 2042 } | 2038 } |
| 2043 | 2039 |
| 2044 // Deoptimization point in case the binary operation may have side effects. | 2040 // Deoptimization point in case the binary operation may have side effects. |
| 2045 PrepareForBailout(expr->binary_operation(), TOS_REG); | 2041 PrepareForBailout(expr->binary_operation(), TOS_REG); |
| 2046 } else { | 2042 } else { |
| 2047 VisitForAccumulatorValue(expr->value()); | 2043 VisitForAccumulatorValue(expr->value()); |
| 2048 } | 2044 } |
| 2049 | 2045 |
| 2050 // Record source position before possible IC call. | 2046 // Record source position before possible IC call. |
| 2051 SetSourcePosition(expr->position()); | 2047 SetSourcePosition(expr->position()); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2414 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2410 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
| 2415 // Stack: receiver, home_object, key. | 2411 // Stack: receiver, home_object, key. |
| 2416 SetSourcePosition(prop->position()); | 2412 SetSourcePosition(prop->position()); |
| 2417 | 2413 |
| 2418 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2414 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| 2419 } | 2415 } |
| 2420 | 2416 |
| 2421 | 2417 |
| 2422 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2418 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
| 2423 Token::Value op, | 2419 Token::Value op, |
| 2424 OverwriteMode mode, | |
| 2425 Expression* left_expr, | 2420 Expression* left_expr, |
| 2426 Expression* right_expr) { | 2421 Expression* right_expr) { |
| 2427 Label done, smi_case, stub_call; | 2422 Label done, smi_case, stub_call; |
| 2428 | 2423 |
| 2429 Register scratch1 = a2; | 2424 Register scratch1 = a2; |
| 2430 Register scratch2 = a3; | 2425 Register scratch2 = a3; |
| 2431 | 2426 |
| 2432 // Get the arguments. | 2427 // Get the arguments. |
| 2433 Register left = a1; | 2428 Register left = a1; |
| 2434 Register right = a0; | 2429 Register right = a0; |
| 2435 __ pop(left); | 2430 __ pop(left); |
| 2436 __ mov(a0, result_register()); | 2431 __ mov(a0, result_register()); |
| 2437 | 2432 |
| 2438 // Perform combined smi check on both operands. | 2433 // Perform combined smi check on both operands. |
| 2439 __ Or(scratch1, left, Operand(right)); | 2434 __ Or(scratch1, left, Operand(right)); |
| 2440 STATIC_ASSERT(kSmiTag == 0); | 2435 STATIC_ASSERT(kSmiTag == 0); |
| 2441 JumpPatchSite patch_site(masm_); | 2436 JumpPatchSite patch_site(masm_); |
| 2442 patch_site.EmitJumpIfSmi(scratch1, &smi_case); | 2437 patch_site.EmitJumpIfSmi(scratch1, &smi_case); |
| 2443 | 2438 |
| 2444 __ bind(&stub_call); | 2439 __ bind(&stub_call); |
| 2445 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); | 2440 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
| 2446 CallIC(code, expr->BinaryOperationFeedbackId()); | 2441 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2447 patch_site.EmitPatchInfo(); | 2442 patch_site.EmitPatchInfo(); |
| 2448 __ jmp(&done); | 2443 __ jmp(&done); |
| 2449 | 2444 |
| 2450 __ bind(&smi_case); | 2445 __ bind(&smi_case); |
| 2451 // Smi case. This code works the same way as the smi-smi case in the type | 2446 // Smi case. This code works the same way as the smi-smi case in the type |
| 2452 // recording binary operation stub, see | 2447 // recording binary operation stub, see |
| 2453 switch (op) { | 2448 switch (op) { |
| 2454 case Token::SAR: | 2449 case Token::SAR: |
| 2455 __ GetLeastBitsFromSmi(scratch1, right, 5); | 2450 __ GetLeastBitsFromSmi(scratch1, right, 5); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2564 } | 2559 } |
| 2565 | 2560 |
| 2566 // prototype | 2561 // prototype |
| 2567 __ CallRuntime(Runtime::kToFastProperties, 1); | 2562 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2568 | 2563 |
| 2569 // constructor | 2564 // constructor |
| 2570 __ CallRuntime(Runtime::kToFastProperties, 1); | 2565 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 2571 } | 2566 } |
| 2572 | 2567 |
| 2573 | 2568 |
| 2574 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 2569 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { |
| 2575 Token::Value op, | |
| 2576 OverwriteMode mode) { | |
| 2577 __ mov(a0, result_register()); | 2570 __ mov(a0, result_register()); |
| 2578 __ pop(a1); | 2571 __ pop(a1); |
| 2579 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op, mode).code(); | 2572 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), op).code(); |
| 2580 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2573 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
| 2581 CallIC(code, expr->BinaryOperationFeedbackId()); | 2574 CallIC(code, expr->BinaryOperationFeedbackId()); |
| 2582 patch_site.EmitPatchInfo(); | 2575 patch_site.EmitPatchInfo(); |
| 2583 context()->Plug(v0); | 2576 context()->Plug(v0); |
| 2584 } | 2577 } |
| 2585 | 2578 |
| 2586 | 2579 |
| 2587 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2580 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
| 2588 DCHECK(expr->IsValidReferenceExpression()); | 2581 DCHECK(expr->IsValidReferenceExpression()); |
| 2589 | 2582 |
| (...skipping 2253 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5376 Assembler::target_address_at(pc_immediate_load_address)) == | 5368 Assembler::target_address_at(pc_immediate_load_address)) == |
| 5377 reinterpret_cast<uint64_t>( | 5369 reinterpret_cast<uint64_t>( |
| 5378 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5370 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 5379 return OSR_AFTER_STACK_CHECK; | 5371 return OSR_AFTER_STACK_CHECK; |
| 5380 } | 5372 } |
| 5381 | 5373 |
| 5382 | 5374 |
| 5383 } } // namespace v8::internal | 5375 } } // namespace v8::internal |
| 5384 | 5376 |
| 5385 #endif // V8_TARGET_ARCH_MIPS64 | 5377 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |