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