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 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2709 int arg_count = args->length(); | 2713 int arg_count = args->length(); |
2710 { PreservePositionScope scope(masm()->positions_recorder()); | 2714 { PreservePositionScope scope(masm()->positions_recorder()); |
2711 for (int i = 0; i < arg_count; i++) { | 2715 for (int i = 0; i < arg_count; i++) { |
2712 VisitForStackValue(args->at(i)); | 2716 VisitForStackValue(args->at(i)); |
2713 } | 2717 } |
2714 } | 2718 } |
2715 // Record source position for debugger. | 2719 // Record source position for debugger. |
2716 SetSourcePosition(expr->position()); | 2720 SetSourcePosition(expr->position()); |
2717 | 2721 |
2718 Handle<Object> uninitialized = | 2722 Handle<Object> uninitialized = |
2719 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2723 TypeFeedbackInfo::UninitializedSentinel(isolate()); |
2720 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); | 2724 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized); |
2721 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); | 2725 __ Move(r2, FeedbackVector()); |
2722 __ mov(r2, Operand(cell)); | 2726 __ mov(r3, Operand(Smi::FromInt(expr->CallFeedbackSlot()))); |
2723 | 2727 |
2724 // Record call targets in unoptimized code. | 2728 // Record call targets in unoptimized code. |
2725 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); | 2729 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); |
2726 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2730 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2727 __ CallStub(&stub, expr->CallFeedbackId()); | 2731 __ CallStub(&stub); |
2728 RecordJSReturnSite(expr); | 2732 RecordJSReturnSite(expr); |
2729 // Restore context register. | 2733 // Restore context register. |
2730 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2734 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2731 context()->DropAndPlug(1, r0); | 2735 context()->DropAndPlug(1, r0); |
2732 } | 2736 } |
2733 | 2737 |
2734 | 2738 |
2735 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2739 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
2736 // r4: copy of the first argument or undefined if it doesn't exist. | 2740 // r4: copy of the first argument or undefined if it doesn't exist. |
2737 if (arg_count > 0) { | 2741 if (arg_count > 0) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2898 // Call the construct call builtin that handles allocation and | 2902 // Call the construct call builtin that handles allocation and |
2899 // constructor invocation. | 2903 // constructor invocation. |
2900 SetSourcePosition(expr->position()); | 2904 SetSourcePosition(expr->position()); |
2901 | 2905 |
2902 // Load function and argument count into r1 and r0. | 2906 // Load function and argument count into r1 and r0. |
2903 __ mov(r0, Operand(arg_count)); | 2907 __ mov(r0, Operand(arg_count)); |
2904 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 2908 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
2905 | 2909 |
2906 // Record call targets in unoptimized code. | 2910 // Record call targets in unoptimized code. |
2907 Handle<Object> uninitialized = | 2911 Handle<Object> uninitialized = |
2908 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2912 TypeFeedbackInfo::UninitializedSentinel(isolate()); |
2909 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); | 2913 StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized); |
2910 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); | 2914 __ Move(r2, FeedbackVector()); |
2911 __ mov(r2, Operand(cell)); | 2915 __ mov(r3, Operand(Smi::FromInt(expr->CallNewFeedbackSlot()))); |
2912 | 2916 |
2913 CallConstructStub stub(RECORD_CALL_TARGET); | 2917 CallConstructStub stub(RECORD_CALL_TARGET); |
2914 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); | 2918 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
2915 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2919 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
2916 context()->Plug(r0); | 2920 context()->Plug(r0); |
2917 } | 2921 } |
2918 | 2922 |
2919 | 2923 |
2920 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 2924 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
2921 ZoneList<Expression*>* args = expr->arguments(); | 2925 ZoneList<Expression*>* args = expr->arguments(); |
(...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4919 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4923 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
4920 reinterpret_cast<uint32_t>( | 4924 reinterpret_cast<uint32_t>( |
4921 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4925 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4922 return OSR_AFTER_STACK_CHECK; | 4926 return OSR_AFTER_STACK_CHECK; |
4923 } | 4927 } |
4924 | 4928 |
4925 | 4929 |
4926 } } // namespace v8::internal | 4930 } } // namespace v8::internal |
4927 | 4931 |
4928 #endif // V8_TARGET_ARCH_ARM | 4932 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |