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 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2561 } | 2561 } |
2562 | 2562 |
2563 | 2563 |
2564 MaybeHandle<Object> BinaryOpIC::Transition( | 2564 MaybeHandle<Object> BinaryOpIC::Transition( |
2565 Handle<AllocationSite> allocation_site, Handle<Object> left, | 2565 Handle<AllocationSite> allocation_site, Handle<Object> left, |
2566 Handle<Object> right) { | 2566 Handle<Object> right) { |
2567 BinaryOpICState state(isolate(), target()->extra_ic_state()); | 2567 BinaryOpICState state(isolate(), target()->extra_ic_state()); |
2568 | 2568 |
2569 // Compute the actual result using the builtin for the binary operation. | 2569 // Compute the actual result using the builtin for the binary operation. |
2570 Object* builtin = isolate()->js_builtins_object()->javascript_builtin( | 2570 Object* builtin = isolate()->js_builtins_object()->javascript_builtin( |
2571 TokenToJSBuiltin(state.op())); | 2571 TokenToJSBuiltin(state.op(), state.language_mode())); |
2572 Handle<JSFunction> function = handle(JSFunction::cast(builtin), isolate()); | 2572 Handle<JSFunction> function = handle(JSFunction::cast(builtin), isolate()); |
2573 Handle<Object> result; | 2573 Handle<Object> result; |
2574 ASSIGN_RETURN_ON_EXCEPTION( | 2574 ASSIGN_RETURN_ON_EXCEPTION( |
2575 isolate(), result, Execution::Call(isolate(), function, left, 1, &right), | 2575 isolate(), result, Execution::Call(isolate(), function, left, 1, &right), |
2576 Object); | 2576 Object); |
2577 | 2577 |
2578 // Do not try to update the target if the code was marked for lazy | 2578 // Do not try to update the target if the code was marked for lazy |
2579 // deoptimization. (Since we do not relocate addresses in these | 2579 // deoptimization. (Since we do not relocate addresses in these |
2580 // code objects, an attempt to access the target could fail.) | 2580 // code objects, an attempt to access the target could fail.) |
2581 if (AddressIsDeoptimizedCode()) { | 2581 if (AddressIsDeoptimizedCode()) { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2798 } | 2798 } |
2799 | 2799 |
2800 | 2800 |
2801 RUNTIME_FUNCTION(Unreachable) { | 2801 RUNTIME_FUNCTION(Unreachable) { |
2802 UNREACHABLE(); | 2802 UNREACHABLE(); |
2803 CHECK(false); | 2803 CHECK(false); |
2804 return isolate->heap()->undefined_value(); | 2804 return isolate->heap()->undefined_value(); |
2805 } | 2805 } |
2806 | 2806 |
2807 | 2807 |
2808 Builtins::JavaScript BinaryOpIC::TokenToJSBuiltin(Token::Value op) { | 2808 Builtins::JavaScript BinaryOpIC::TokenToJSBuiltin(Token::Value op, |
2809 switch (op) { | 2809 LanguageMode language_mode) { |
2810 default: | 2810 if (is_strong(language_mode)) { |
arv (Not doing code reviews)
2015/04/24 14:14:23
Why is this needed? The two branches looks identic
conradw
2015/04/24 14:42:32
In strong mode, the strong version of the builtin
| |
2811 UNREACHABLE(); | 2811 switch (op) { |
2812 case Token::ADD: | 2812 default: UNREACHABLE(); |
2813 return Builtins::ADD; | 2813 case Token::ADD: return Builtins::ADD; |
2814 break; | 2814 case Token::SUB: return Builtins::SUB_STRONG; |
2815 case Token::SUB: | 2815 case Token::MUL: return Builtins::MUL_STRONG; |
2816 return Builtins::SUB; | 2816 case Token::DIV: return Builtins::DIV_STRONG; |
2817 break; | 2817 case Token::MOD: return Builtins::MOD_STRONG; |
2818 case Token::MUL: | 2818 case Token::BIT_OR: return Builtins::BIT_OR; |
2819 return Builtins::MUL; | 2819 case Token::BIT_AND: return Builtins::BIT_AND; |
2820 break; | 2820 case Token::BIT_XOR: return Builtins::BIT_XOR; |
2821 case Token::DIV: | 2821 case Token::SAR: return Builtins::SAR; |
2822 return Builtins::DIV; | 2822 case Token::SHR: return Builtins::SHR; |
2823 break; | 2823 case Token::SHL: return Builtins::SHL; |
2824 case Token::MOD: | 2824 } |
2825 return Builtins::MOD; | 2825 } else { |
2826 break; | 2826 switch (op) { |
2827 case Token::BIT_OR: | 2827 default: UNREACHABLE(); |
2828 return Builtins::BIT_OR; | 2828 case Token::ADD: return Builtins::ADD; |
2829 break; | 2829 case Token::SUB: return Builtins::SUB; |
2830 case Token::BIT_AND: | 2830 case Token::MUL: return Builtins::MUL; |
2831 return Builtins::BIT_AND; | 2831 case Token::DIV: return Builtins::DIV; |
2832 break; | 2832 case Token::MOD: return Builtins::MOD; |
2833 case Token::BIT_XOR: | 2833 case Token::BIT_OR: return Builtins::BIT_OR; |
2834 return Builtins::BIT_XOR; | 2834 case Token::BIT_AND: return Builtins::BIT_AND; |
2835 break; | 2835 case Token::BIT_XOR: return Builtins::BIT_XOR; |
2836 case Token::SAR: | 2836 case Token::SAR: return Builtins::SAR; |
2837 return Builtins::SAR; | 2837 case Token::SHR: return Builtins::SHR; |
2838 break; | 2838 case Token::SHL: return Builtins::SHL; |
2839 case Token::SHR: | 2839 } |
2840 return Builtins::SHR; | |
2841 break; | |
2842 case Token::SHL: | |
2843 return Builtins::SHL; | |
2844 break; | |
2845 } | 2840 } |
2846 } | 2841 } |
2847 | 2842 |
2848 | 2843 |
2849 Handle<Object> ToBooleanIC::ToBoolean(Handle<Object> object) { | 2844 Handle<Object> ToBooleanIC::ToBoolean(Handle<Object> object) { |
2850 ToBooleanStub stub(isolate(), target()->extra_ic_state()); | 2845 ToBooleanStub stub(isolate(), target()->extra_ic_state()); |
2851 bool to_boolean_value = stub.UpdateStatus(object); | 2846 bool to_boolean_value = stub.UpdateStatus(object); |
2852 Handle<Code> code = stub.GetCode(); | 2847 Handle<Code> code = stub.GetCode(); |
2853 set_target(*code); | 2848 set_target(*code); |
2854 return handle(Smi::FromInt(to_boolean_value ? 1 : 0), isolate()); | 2849 return handle(Smi::FromInt(to_boolean_value ? 1 : 0), isolate()); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3045 static const Address IC_utilities[] = { | 3040 static const Address IC_utilities[] = { |
3046 #define ADDR(name) FUNCTION_ADDR(name), | 3041 #define ADDR(name) FUNCTION_ADDR(name), |
3047 IC_UTIL_LIST(ADDR) NULL | 3042 IC_UTIL_LIST(ADDR) NULL |
3048 #undef ADDR | 3043 #undef ADDR |
3049 }; | 3044 }; |
3050 | 3045 |
3051 | 3046 |
3052 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3047 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
3053 } | 3048 } |
3054 } // namespace v8::internal | 3049 } // namespace v8::internal |
OLD | NEW |