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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // o fp: our caller's frame pointer | 123 // o fp: our caller's frame pointer |
124 // o sp: stack pointer | 124 // o sp: stack pointer |
125 // o lr: return address | 125 // o lr: return address |
126 // | 126 // |
127 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 127 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
128 // frames-arm.h for its layout. | 128 // frames-arm.h for its layout. |
129 void FullCodeGenerator::Generate() { | 129 void FullCodeGenerator::Generate() { |
130 CompilationInfo* info = info_; | 130 CompilationInfo* info = info_; |
131 handler_table_ = | 131 handler_table_ = |
132 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); | 132 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); |
| 133 |
| 134 InitializeFeedbackVector(); |
| 135 |
133 profiling_counter_ = isolate()->factory()->NewCell( | 136 profiling_counter_ = isolate()->factory()->NewCell( |
134 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 137 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
135 SetFunctionPosition(function()); | 138 SetFunctionPosition(function()); |
136 Comment cmnt(masm_, "[ function compiled by full code generator"); | 139 Comment cmnt(masm_, "[ function compiled by full code generator"); |
137 | 140 |
138 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 141 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
139 | 142 |
140 #ifdef DEBUG | 143 #ifdef DEBUG |
141 if (strlen(FLAG_stop_at) > 0 && | 144 if (strlen(FLAG_stop_at) > 0 && |
142 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 145 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 VisitStatements(clause->statements()); | 1070 VisitStatements(clause->statements()); |
1068 } | 1071 } |
1069 | 1072 |
1070 __ bind(nested_statement.break_label()); | 1073 __ bind(nested_statement.break_label()); |
1071 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1074 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
1072 } | 1075 } |
1073 | 1076 |
1074 | 1077 |
1075 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 1078 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
1076 Comment cmnt(masm_, "[ ForInStatement"); | 1079 Comment cmnt(masm_, "[ ForInStatement"); |
| 1080 int slot = stmt->ForInFeedbackSlot(); |
1077 SetStatementPosition(stmt); | 1081 SetStatementPosition(stmt); |
1078 | 1082 |
1079 Label loop, exit; | 1083 Label loop, exit; |
1080 ForIn loop_statement(this, stmt); | 1084 ForIn loop_statement(this, stmt); |
1081 increment_loop_depth(); | 1085 increment_loop_depth(); |
1082 | 1086 |
1083 // Get the object to enumerate over. If the object is null or undefined, skip | 1087 // Get the object to enumerate over. If the object is null or undefined, skip |
1084 // over the loop. See ECMA-262 version 5, section 12.6.4. | 1088 // over the loop. See ECMA-262 version 5, section 12.6.4. |
1085 VisitForAccumulatorValue(stmt->enumerable()); | 1089 VisitForAccumulatorValue(stmt->enumerable()); |
1086 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 1090 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 __ jmp(&loop); | 1160 __ jmp(&loop); |
1157 | 1161 |
1158 __ bind(&no_descriptors); | 1162 __ bind(&no_descriptors); |
1159 __ Drop(1); | 1163 __ Drop(1); |
1160 __ jmp(&exit); | 1164 __ jmp(&exit); |
1161 | 1165 |
1162 // We got a fixed array in register r0. Iterate through that. | 1166 // We got a fixed array in register r0. Iterate through that. |
1163 Label non_proxy; | 1167 Label non_proxy; |
1164 __ bind(&fixed_array); | 1168 __ bind(&fixed_array); |
1165 | 1169 |
1166 Handle<Cell> cell = isolate()->factory()->NewCell( | 1170 Handle<Object> feedback = Handle<Object>( |
1167 Handle<Object>(Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker), | 1171 Smi::FromInt(TypeFeedbackInfo::kForInFastCaseMarker), |
1168 isolate())); | 1172 isolate()); |
1169 RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell); | 1173 StoreFeedbackVectorSlot(slot, feedback); |
1170 __ Move(r1, cell); | 1174 __ Move(r1, FeedbackVector()); |
1171 __ mov(r2, Operand(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker))); | 1175 __ mov(r2, Operand(Smi::FromInt(TypeFeedbackInfo::kForInSlowCaseMarker))); |
1172 __ str(r2, FieldMemOperand(r1, Cell::kValueOffset)); | 1176 __ str(r2, FieldMemOperand(r1, FixedArray::OffsetOfElementAt(slot))); |
1173 | 1177 |
1174 __ mov(r1, Operand(Smi::FromInt(1))); // Smi indicates slow check | 1178 __ mov(r1, Operand(Smi::FromInt(1))); // Smi indicates slow check |
1175 __ ldr(r2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object | 1179 __ ldr(r2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object |
1176 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1180 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
1177 __ CompareObjectType(r2, r3, r3, LAST_JS_PROXY_TYPE); | 1181 __ CompareObjectType(r2, r3, r3, LAST_JS_PROXY_TYPE); |
1178 __ b(gt, &non_proxy); | 1182 __ b(gt, &non_proxy); |
1179 __ mov(r1, Operand(Smi::FromInt(0))); // Zero indicates proxy | 1183 __ mov(r1, Operand(Smi::FromInt(0))); // Zero indicates proxy |
1180 __ bind(&non_proxy); | 1184 __ bind(&non_proxy); |
1181 __ Push(r1, r0); // Smi and array | 1185 __ Push(r1, r0); // Smi and array |
1182 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 1186 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2667 int arg_count = args->length(); | 2671 int arg_count = args->length(); |
2668 { PreservePositionScope scope(masm()->positions_recorder()); | 2672 { PreservePositionScope scope(masm()->positions_recorder()); |
2669 for (int i = 0; i < arg_count; i++) { | 2673 for (int i = 0; i < arg_count; i++) { |
2670 VisitForStackValue(args->at(i)); | 2674 VisitForStackValue(args->at(i)); |
2671 } | 2675 } |
2672 } | 2676 } |
2673 // Record source position for debugger. | 2677 // Record source position for debugger. |
2674 SetSourcePosition(expr->position()); | 2678 SetSourcePosition(expr->position()); |
2675 | 2679 |
2676 Handle<Object> uninitialized = | 2680 Handle<Object> uninitialized = |
2677 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2681 TypeFeedbackInfo::UninitializedSentinel(isolate()); |
2678 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); | 2682 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized); |
2679 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); | 2683 __ Move(r2, FeedbackVector()); |
2680 __ mov(r2, Operand(cell)); | 2684 __ mov(r3, Operand(Smi::FromInt(expr->CallFeedbackSlot()))); |
2681 | 2685 |
2682 // Record call targets in unoptimized code. | 2686 // Record call targets in unoptimized code. |
2683 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); | 2687 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); |
2684 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2688 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2685 __ CallStub(&stub, expr->CallFeedbackId()); | 2689 __ CallStub(&stub, expr->CallFeedbackId()); |
2686 RecordJSReturnSite(expr); | 2690 RecordJSReturnSite(expr); |
2687 // Restore context register. | 2691 // Restore context register. |
2688 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2692 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2689 context()->DropAndPlug(1, r0); | 2693 context()->DropAndPlug(1, r0); |
2690 } | 2694 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2861 // Call the construct call builtin that handles allocation and | 2865 // Call the construct call builtin that handles allocation and |
2862 // constructor invocation. | 2866 // constructor invocation. |
2863 SetSourcePosition(expr->position()); | 2867 SetSourcePosition(expr->position()); |
2864 | 2868 |
2865 // Load function and argument count into r1 and r0. | 2869 // Load function and argument count into r1 and r0. |
2866 __ mov(r0, Operand(arg_count)); | 2870 __ mov(r0, Operand(arg_count)); |
2867 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 2871 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
2868 | 2872 |
2869 // Record call targets in unoptimized code. | 2873 // Record call targets in unoptimized code. |
2870 Handle<Object> uninitialized = | 2874 Handle<Object> uninitialized = |
2871 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2875 TypeFeedbackInfo::UninitializedSentinel(isolate()); |
2872 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); | 2876 StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized); |
2873 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); | 2877 __ Move(r2, FeedbackVector()); |
2874 __ mov(r2, Operand(cell)); | 2878 __ mov(r3, Operand(Smi::FromInt(expr->CallNewFeedbackSlot()))); |
2875 | 2879 |
2876 CallConstructStub stub(RECORD_CALL_TARGET); | 2880 CallConstructStub stub(RECORD_CALL_TARGET); |
2877 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); | 2881 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
2878 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2882 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
2879 context()->Plug(r0); | 2883 context()->Plug(r0); |
2880 } | 2884 } |
2881 | 2885 |
2882 | 2886 |
2883 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 2887 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
2884 ZoneList<Expression*>* args = expr->arguments(); | 2888 ZoneList<Expression*>* args = expr->arguments(); |
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4907 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4911 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
4908 reinterpret_cast<uint32_t>( | 4912 reinterpret_cast<uint32_t>( |
4909 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4913 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4910 return OSR_AFTER_STACK_CHECK; | 4914 return OSR_AFTER_STACK_CHECK; |
4911 } | 4915 } |
4912 | 4916 |
4913 | 4917 |
4914 } } // namespace v8::internal | 4918 } } // namespace v8::internal |
4915 | 4919 |
4916 #endif // V8_TARGET_ARCH_ARM | 4920 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |