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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // o ebp: our caller's frame pointer | 112 // o ebp: our caller's frame pointer |
113 // o esp: stack pointer (pointing to return address) | 113 // o esp: stack pointer (pointing to return address) |
114 // | 114 // |
115 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 115 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
116 // frames-ia32.h for its layout. | 116 // frames-ia32.h for its layout. |
117 void FullCodeGenerator::Generate() { | 117 void FullCodeGenerator::Generate() { |
118 CompilationInfo* info = info_; | 118 CompilationInfo* info = info_; |
119 handler_table_ = | 119 handler_table_ = |
120 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); | 120 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); |
121 | 121 |
| 122 InitializeFeedbackVector(); |
| 123 |
122 profiling_counter_ = isolate()->factory()->NewCell( | 124 profiling_counter_ = isolate()->factory()->NewCell( |
123 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 125 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
124 SetFunctionPosition(function()); | 126 SetFunctionPosition(function()); |
125 Comment cmnt(masm_, "[ function compiled by full code generator"); | 127 Comment cmnt(masm_, "[ function compiled by full code generator"); |
126 | 128 |
127 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 129 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
128 | 130 |
129 #ifdef DEBUG | 131 #ifdef DEBUG |
130 if (strlen(FLAG_stop_at) > 0 && | 132 if (strlen(FLAG_stop_at) > 0 && |
131 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 133 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 __ jmp(&loop); | 1097 __ jmp(&loop); |
1096 | 1098 |
1097 __ bind(&no_descriptors); | 1099 __ bind(&no_descriptors); |
1098 __ add(esp, Immediate(kPointerSize)); | 1100 __ add(esp, Immediate(kPointerSize)); |
1099 __ jmp(&exit); | 1101 __ jmp(&exit); |
1100 | 1102 |
1101 // We got a fixed array in register eax. Iterate through that. | 1103 // We got a fixed array in register eax. Iterate through that. |
1102 Label non_proxy; | 1104 Label non_proxy; |
1103 __ bind(&fixed_array); | 1105 __ bind(&fixed_array); |
1104 | 1106 |
| 1107 Handle<Object> feedback = Handle<Object>( |
| 1108 Smi::FromInt(TypeFeedbackInfo::kForInFastCaseMarker), |
| 1109 isolate()); |
| 1110 StoreFeedbackVectorSlot(slot, feedback); |
| 1111 |
1105 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1112 // No need for a write barrier, we are storing a Smi in the feedback vector. |
1106 __ LoadHeapObject(ebx, FeedbackVector()); | 1113 __ LoadHeapObject(ebx, FeedbackVector()); |
1107 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(slot)), | 1114 __ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(slot)), |
1108 Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate()))); | 1115 Immediate(Smi::FromInt(TypeFeedbackInfo::kForInSlowCaseMarker))); |
1109 | 1116 |
1110 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check | 1117 __ mov(ebx, Immediate(Smi::FromInt(1))); // Smi indicates slow check |
1111 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object | 1118 __ mov(ecx, Operand(esp, 0 * kPointerSize)); // Get enumerated object |
1112 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1119 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
1113 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); | 1120 __ CmpObjectType(ecx, LAST_JS_PROXY_TYPE, ecx); |
1114 __ j(above, &non_proxy); | 1121 __ j(above, &non_proxy); |
1115 __ Set(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy | 1122 __ Set(ebx, Immediate(Smi::FromInt(0))); // Zero indicates proxy |
1116 __ bind(&non_proxy); | 1123 __ bind(&non_proxy); |
1117 __ push(ebx); // Smi | 1124 __ push(ebx); // Smi |
1118 __ push(eax); // Array | 1125 __ push(eax); // Array |
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 ZoneList<Expression*>* args = expr->arguments(); | 2658 ZoneList<Expression*>* args = expr->arguments(); |
2652 int arg_count = args->length(); | 2659 int arg_count = args->length(); |
2653 { PreservePositionScope scope(masm()->positions_recorder()); | 2660 { PreservePositionScope scope(masm()->positions_recorder()); |
2654 for (int i = 0; i < arg_count; i++) { | 2661 for (int i = 0; i < arg_count; i++) { |
2655 VisitForStackValue(args->at(i)); | 2662 VisitForStackValue(args->at(i)); |
2656 } | 2663 } |
2657 } | 2664 } |
2658 // Record source position for debugger. | 2665 // Record source position for debugger. |
2659 SetSourcePosition(expr->position()); | 2666 SetSourcePosition(expr->position()); |
2660 | 2667 |
| 2668 Handle<Object> uninitialized = |
| 2669 TypeFeedbackInfo::UninitializedSentinel(isolate()); |
| 2670 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized); |
2661 __ LoadHeapObject(ebx, FeedbackVector()); | 2671 __ LoadHeapObject(ebx, FeedbackVector()); |
2662 __ mov(edx, Immediate(Smi::FromInt(expr->CallFeedbackSlot()))); | 2672 __ mov(edx, Immediate(Smi::FromInt(expr->CallFeedbackSlot()))); |
2663 | 2673 |
2664 // Record call targets in unoptimized code. | 2674 // Record call targets in unoptimized code. |
2665 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); | 2675 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); |
2666 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2676 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
2667 __ CallStub(&stub); | 2677 __ CallStub(&stub); |
2668 | 2678 |
2669 RecordJSReturnSite(expr); | 2679 RecordJSReturnSite(expr); |
2670 // Restore context register. | 2680 // Restore context register. |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2828 | 2838 |
2829 // Call the construct call builtin that handles allocation and | 2839 // Call the construct call builtin that handles allocation and |
2830 // constructor invocation. | 2840 // constructor invocation. |
2831 SetSourcePosition(expr->position()); | 2841 SetSourcePosition(expr->position()); |
2832 | 2842 |
2833 // Load function and argument count into edi and eax. | 2843 // Load function and argument count into edi and eax. |
2834 __ Set(eax, Immediate(arg_count)); | 2844 __ Set(eax, Immediate(arg_count)); |
2835 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2845 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
2836 | 2846 |
2837 // Record call targets in unoptimized code. | 2847 // Record call targets in unoptimized code. |
| 2848 Handle<Object> uninitialized = |
| 2849 TypeFeedbackInfo::UninitializedSentinel(isolate()); |
| 2850 StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized); |
2838 __ LoadHeapObject(ebx, FeedbackVector()); | 2851 __ LoadHeapObject(ebx, FeedbackVector()); |
2839 __ mov(edx, Immediate(Smi::FromInt(expr->CallNewFeedbackSlot()))); | 2852 __ mov(edx, Immediate(Smi::FromInt(expr->CallNewFeedbackSlot()))); |
2840 | 2853 |
2841 CallConstructStub stub(RECORD_CALL_TARGET); | 2854 CallConstructStub stub(RECORD_CALL_TARGET); |
2842 __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); | 2855 __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
2843 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2856 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
2844 context()->Plug(eax); | 2857 context()->Plug(eax); |
2845 } | 2858 } |
2846 | 2859 |
2847 | 2860 |
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4897 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4910 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4898 Assembler::target_address_at(call_target_address, | 4911 Assembler::target_address_at(call_target_address, |
4899 unoptimized_code)); | 4912 unoptimized_code)); |
4900 return OSR_AFTER_STACK_CHECK; | 4913 return OSR_AFTER_STACK_CHECK; |
4901 } | 4914 } |
4902 | 4915 |
4903 | 4916 |
4904 } } // namespace v8::internal | 4917 } } // namespace v8::internal |
4905 | 4918 |
4906 #endif // V8_TARGET_ARCH_IA32 | 4919 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |