OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 void FullCodeGenerator::DoTest(Label* if_true, | 545 void FullCodeGenerator::DoTest(Label* if_true, |
546 Label* if_false, | 546 Label* if_false, |
547 Label* fall_through) { | 547 Label* fall_through) { |
548 // Emit the inlined tests assumed by the stub. | 548 // Emit the inlined tests assumed by the stub. |
549 __ CompareRoot(result_register(), Heap::kUndefinedValueRootIndex); | 549 __ CompareRoot(result_register(), Heap::kUndefinedValueRootIndex); |
550 __ j(equal, if_false); | 550 __ j(equal, if_false); |
551 __ CompareRoot(result_register(), Heap::kTrueValueRootIndex); | 551 __ CompareRoot(result_register(), Heap::kTrueValueRootIndex); |
552 __ j(equal, if_true); | 552 __ j(equal, if_true); |
553 __ CompareRoot(result_register(), Heap::kFalseValueRootIndex); | 553 __ CompareRoot(result_register(), Heap::kFalseValueRootIndex); |
554 __ j(equal, if_false); | 554 __ j(equal, if_false); |
555 ASSERT_EQ(0, kSmiTag); | 555 STATIC_ASSERT(kSmiTag == 0); |
556 __ SmiCompare(result_register(), Smi::FromInt(0)); | 556 __ SmiCompare(result_register(), Smi::FromInt(0)); |
557 __ j(equal, if_false); | 557 __ j(equal, if_false); |
558 Condition is_smi = masm_->CheckSmi(result_register()); | 558 Condition is_smi = masm_->CheckSmi(result_register()); |
559 __ j(is_smi, if_true); | 559 __ j(is_smi, if_true); |
560 | 560 |
561 // Call the ToBoolean stub for all other cases. | 561 // Call the ToBoolean stub for all other cases. |
562 ToBooleanStub stub; | 562 ToBooleanStub stub; |
563 __ push(result_register()); | 563 __ push(result_register()); |
564 __ CallStub(&stub); | 564 __ CallStub(&stub); |
565 __ testq(rax, rax); | 565 __ testq(rax, rax); |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 | 1025 |
1026 // Exit and decrement the loop depth. | 1026 // Exit and decrement the loop depth. |
1027 __ bind(&exit); | 1027 __ bind(&exit); |
1028 decrement_loop_depth(); | 1028 decrement_loop_depth(); |
1029 } | 1029 } |
1030 | 1030 |
1031 | 1031 |
1032 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 1032 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
1033 bool pretenure) { | 1033 bool pretenure) { |
1034 // Use the fast case closure allocation code that allocates in new | 1034 // Use the fast case closure allocation code that allocates in new |
1035 // space for nested functions that don't need literals cloning. | 1035 // space for nested functions that don't need literals cloning. If |
1036 if (scope()->is_function_scope() && | 1036 // we're running with the --always-opt or the --prepare-always-opt |
| 1037 // flag, we need to use the runtime function so that the new function |
| 1038 // we are creating here gets a chance to have its code optimized and |
| 1039 // doesn't just get a copy of the existing unoptimized code. |
| 1040 if (!FLAG_always_opt && |
| 1041 !FLAG_prepare_always_opt && |
| 1042 scope()->is_function_scope() && |
1037 info->num_literals() == 0 && | 1043 info->num_literals() == 0 && |
1038 !pretenure) { | 1044 !pretenure) { |
1039 FastNewClosureStub stub; | 1045 FastNewClosureStub stub; |
1040 __ Push(info); | 1046 __ Push(info); |
1041 __ CallStub(&stub); | 1047 __ CallStub(&stub); |
1042 } else { | 1048 } else { |
1043 __ push(rsi); | 1049 __ push(rsi); |
1044 __ Push(info); | 1050 __ Push(info); |
1045 __ Push(pretenure ? Factory::true_value() : Factory::false_value()); | 1051 __ Push(pretenure ? Factory::true_value() : Factory::false_value()); |
1046 __ CallRuntime(Runtime::kNewClosure, 3); | 1052 __ CallRuntime(Runtime::kNewClosure, 3); |
(...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3075 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 3081 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
3076 __ j(zero, if_true); | 3082 __ j(zero, if_true); |
3077 __ jmp(if_false); | 3083 __ jmp(if_false); |
3078 | 3084 |
3079 context()->Plug(if_true, if_false); | 3085 context()->Plug(if_true, if_false); |
3080 } | 3086 } |
3081 | 3087 |
3082 | 3088 |
3083 void FullCodeGenerator::EmitGetCachedArrayIndex(ZoneList<Expression*>* args) { | 3089 void FullCodeGenerator::EmitGetCachedArrayIndex(ZoneList<Expression*>* args) { |
3084 ASSERT(args->length() == 1); | 3090 ASSERT(args->length() == 1); |
| 3091 VisitForAccumulatorValue(args->at(0)); |
3085 | 3092 |
3086 VisitForAccumulatorValue(args->at(0)); | 3093 if (FLAG_debug_code) { |
| 3094 __ AbortIfNotString(rax); |
| 3095 } |
3087 | 3096 |
3088 __ movl(rax, FieldOperand(rax, String::kHashFieldOffset)); | 3097 __ movl(rax, FieldOperand(rax, String::kHashFieldOffset)); |
3089 ASSERT(String::kHashShift >= kSmiTagSize); | 3098 ASSERT(String::kHashShift >= kSmiTagSize); |
3090 __ IndexFromHash(rax, rax); | 3099 __ IndexFromHash(rax, rax); |
3091 | 3100 |
3092 context()->Plug(rax); | 3101 context()->Plug(rax); |
3093 } | 3102 } |
3094 | 3103 |
3095 | 3104 |
3096 void FullCodeGenerator::EmitFastAsciiArrayJoin(ZoneList<Expression*>* args) { | 3105 void FullCodeGenerator::EmitFastAsciiArrayJoin(ZoneList<Expression*>* args) { |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3790 __ nop(); // Signals no inlined code. | 3799 __ nop(); // Signals no inlined code. |
3791 break; | 3800 break; |
3792 default: | 3801 default: |
3793 // Do nothing. | 3802 // Do nothing. |
3794 break; | 3803 break; |
3795 } | 3804 } |
3796 } | 3805 } |
3797 | 3806 |
3798 | 3807 |
3799 void FullCodeGenerator::EmitCallIC(Handle<Code> ic, JumpPatchSite* patch_site) { | 3808 void FullCodeGenerator::EmitCallIC(Handle<Code> ic, JumpPatchSite* patch_site) { |
| 3809 switch (ic->kind()) { |
| 3810 case Code::LOAD_IC: |
| 3811 __ IncrementCounter(&Counters::named_load_full, 1); |
| 3812 break; |
| 3813 case Code::KEYED_LOAD_IC: |
| 3814 __ IncrementCounter(&Counters::keyed_load_full, 1); |
| 3815 break; |
| 3816 case Code::STORE_IC: |
| 3817 __ IncrementCounter(&Counters::named_store_full, 1); |
| 3818 break; |
| 3819 case Code::KEYED_STORE_IC: |
| 3820 __ IncrementCounter(&Counters::keyed_store_full, 1); |
| 3821 default: |
| 3822 break; |
| 3823 } |
| 3824 |
3800 __ call(ic, RelocInfo::CODE_TARGET); | 3825 __ call(ic, RelocInfo::CODE_TARGET); |
3801 if (patch_site != NULL && patch_site->is_bound()) { | 3826 if (patch_site != NULL && patch_site->is_bound()) { |
3802 patch_site->EmitPatchInfo(); | 3827 patch_site->EmitPatchInfo(); |
3803 } else { | 3828 } else { |
3804 __ nop(); // Signals no inlined code. | 3829 __ nop(); // Signals no inlined code. |
3805 } | 3830 } |
3806 } | 3831 } |
3807 | 3832 |
3808 | 3833 |
3809 void FullCodeGenerator::StoreToFrameField(int frame_offset, Register value) { | 3834 void FullCodeGenerator::StoreToFrameField(int frame_offset, Register value) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3850 __ ret(0); | 3875 __ ret(0); |
3851 } | 3876 } |
3852 | 3877 |
3853 | 3878 |
3854 #undef __ | 3879 #undef __ |
3855 | 3880 |
3856 | 3881 |
3857 } } // namespace v8::internal | 3882 } } // namespace v8::internal |
3858 | 3883 |
3859 #endif // V8_TARGET_ARCH_X64 | 3884 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |