| 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 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2658 ZoneList<Expression*>* args = expr->arguments(); | 2651 ZoneList<Expression*>* args = expr->arguments(); |
| 2659 int arg_count = args->length(); | 2652 int arg_count = args->length(); |
| 2660 { PreservePositionScope scope(masm()->positions_recorder()); | 2653 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2661 for (int i = 0; i < arg_count; i++) { | 2654 for (int i = 0; i < arg_count; i++) { |
| 2662 VisitForStackValue(args->at(i)); | 2655 VisitForStackValue(args->at(i)); |
| 2663 } | 2656 } |
| 2664 } | 2657 } |
| 2665 // Record source position for debugger. | 2658 // Record source position for debugger. |
| 2666 SetSourcePosition(expr->position()); | 2659 SetSourcePosition(expr->position()); |
| 2667 | 2660 |
| 2668 Handle<Object> uninitialized = | |
| 2669 TypeFeedbackInfo::UninitializedSentinel(isolate()); | |
| 2670 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized); | |
| 2671 __ LoadHeapObject(ebx, FeedbackVector()); | 2661 __ LoadHeapObject(ebx, FeedbackVector()); |
| 2672 __ mov(edx, Immediate(Smi::FromInt(expr->CallFeedbackSlot()))); | 2662 __ mov(edx, Immediate(Smi::FromInt(expr->CallFeedbackSlot()))); |
| 2673 | 2663 |
| 2674 // Record call targets in unoptimized code. | 2664 // Record call targets in unoptimized code. |
| 2675 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); | 2665 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); |
| 2676 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2666 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
| 2677 __ CallStub(&stub); | 2667 __ CallStub(&stub); |
| 2678 | 2668 |
| 2679 RecordJSReturnSite(expr); | 2669 RecordJSReturnSite(expr); |
| 2680 // Restore context register. | 2670 // Restore context register. |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2838 | 2828 |
| 2839 // Call the construct call builtin that handles allocation and | 2829 // Call the construct call builtin that handles allocation and |
| 2840 // constructor invocation. | 2830 // constructor invocation. |
| 2841 SetSourcePosition(expr->position()); | 2831 SetSourcePosition(expr->position()); |
| 2842 | 2832 |
| 2843 // Load function and argument count into edi and eax. | 2833 // Load function and argument count into edi and eax. |
| 2844 __ Set(eax, Immediate(arg_count)); | 2834 __ Set(eax, Immediate(arg_count)); |
| 2845 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2835 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
| 2846 | 2836 |
| 2847 // Record call targets in unoptimized code. | 2837 // Record call targets in unoptimized code. |
| 2848 Handle<Object> uninitialized = | |
| 2849 TypeFeedbackInfo::UninitializedSentinel(isolate()); | |
| 2850 StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized); | |
| 2851 __ LoadHeapObject(ebx, FeedbackVector()); | 2838 __ LoadHeapObject(ebx, FeedbackVector()); |
| 2852 __ mov(edx, Immediate(Smi::FromInt(expr->CallNewFeedbackSlot()))); | 2839 __ mov(edx, Immediate(Smi::FromInt(expr->CallNewFeedbackSlot()))); |
| 2853 | 2840 |
| 2854 CallConstructStub stub(RECORD_CALL_TARGET); | 2841 CallConstructStub stub(RECORD_CALL_TARGET); |
| 2855 __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); | 2842 __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
| 2856 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2843 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
| 2857 context()->Plug(eax); | 2844 context()->Plug(eax); |
| 2858 } | 2845 } |
| 2859 | 2846 |
| 2860 | 2847 |
| (...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4910 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4897 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4911 Assembler::target_address_at(call_target_address, | 4898 Assembler::target_address_at(call_target_address, |
| 4912 unoptimized_code)); | 4899 unoptimized_code)); |
| 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 |