OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // - jssp: stack pointer. | 122 // - jssp: stack pointer. |
123 // - lr: return address. | 123 // - lr: return address. |
124 // | 124 // |
125 // The function builds a JS frame. See JavaScriptFrameConstants in | 125 // The function builds a JS frame. See JavaScriptFrameConstants in |
126 // frames-arm.h for its layout. | 126 // frames-arm.h for its layout. |
127 void FullCodeGenerator::Generate() { | 127 void FullCodeGenerator::Generate() { |
128 CompilationInfo* info = info_; | 128 CompilationInfo* info = info_; |
129 handler_table_ = | 129 handler_table_ = |
130 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); | 130 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); |
131 | 131 |
| 132 InitializeFeedbackVector(); |
| 133 |
132 profiling_counter_ = isolate()->factory()->NewCell( | 134 profiling_counter_ = isolate()->factory()->NewCell( |
133 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 135 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
134 SetFunctionPosition(function()); | 136 SetFunctionPosition(function()); |
135 Comment cmnt(masm_, "[ Function compiled by full code generator"); | 137 Comment cmnt(masm_, "[ Function compiled by full code generator"); |
136 | 138 |
137 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 139 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
138 | 140 |
139 #ifdef DEBUG | 141 #ifdef DEBUG |
140 if (strlen(FLAG_stop_at) > 0 && | 142 if (strlen(FLAG_stop_at) > 0 && |
141 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 143 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 __ Push(x2, x1, x0); | 1155 __ Push(x2, x1, x0); |
1154 __ B(&loop); | 1156 __ B(&loop); |
1155 | 1157 |
1156 __ Bind(&no_descriptors); | 1158 __ Bind(&no_descriptors); |
1157 __ Drop(1); | 1159 __ Drop(1); |
1158 __ B(&exit); | 1160 __ B(&exit); |
1159 | 1161 |
1160 // We got a fixed array in register x0. Iterate through that. | 1162 // We got a fixed array in register x0. Iterate through that. |
1161 __ Bind(&fixed_array); | 1163 __ Bind(&fixed_array); |
1162 | 1164 |
| 1165 Handle<Object> feedback = Handle<Object>( |
| 1166 Smi::FromInt(TypeFeedbackInfo::kForInFastCaseMarker), |
| 1167 isolate()); |
| 1168 StoreFeedbackVectorSlot(slot, feedback); |
1163 __ LoadObject(x1, FeedbackVector()); | 1169 __ LoadObject(x1, FeedbackVector()); |
1164 __ Mov(x10, Operand(TypeFeedbackInfo::MegamorphicSentinel(isolate()))); | 1170 __ Mov(x10, Operand(Smi::FromInt(TypeFeedbackInfo::kForInSlowCaseMarker))); |
1165 __ Str(x10, FieldMemOperand(x1, FixedArray::OffsetOfElementAt(slot))); | 1171 __ Str(x10, FieldMemOperand(x1, FixedArray::OffsetOfElementAt(slot))); |
1166 | 1172 |
1167 __ Mov(x1, Operand(Smi::FromInt(1))); // Smi indicates slow check. | 1173 __ Mov(x1, Operand(Smi::FromInt(1))); // Smi indicates slow check. |
1168 __ Peek(x10, 0); // Get enumerated object. | 1174 __ Peek(x10, 0); // Get enumerated object. |
1169 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1175 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
1170 // TODO(all): similar check was done already. Can we avoid it here? | 1176 // TODO(all): similar check was done already. Can we avoid it here? |
1171 __ CompareObjectType(x10, x11, x12, LAST_JS_PROXY_TYPE); | 1177 __ CompareObjectType(x10, x11, x12, LAST_JS_PROXY_TYPE); |
1172 ASSERT(Smi::FromInt(0) == 0); | 1178 ASSERT(Smi::FromInt(0) == 0); |
1173 __ CzeroX(x1, le); // Zero indicates proxy. | 1179 __ CzeroX(x1, le); // Zero indicates proxy. |
1174 __ Push(x1, x0); // Smi and array | 1180 __ Push(x1, x0); // Smi and array |
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2401 ZoneList<Expression*>* args = expr->arguments(); | 2407 ZoneList<Expression*>* args = expr->arguments(); |
2402 int arg_count = args->length(); | 2408 int arg_count = args->length(); |
2403 { PreservePositionScope scope(masm()->positions_recorder()); | 2409 { PreservePositionScope scope(masm()->positions_recorder()); |
2404 for (int i = 0; i < arg_count; i++) { | 2410 for (int i = 0; i < arg_count; i++) { |
2405 VisitForStackValue(args->at(i)); | 2411 VisitForStackValue(args->at(i)); |
2406 } | 2412 } |
2407 } | 2413 } |
2408 // Record source position for debugger. | 2414 // Record source position for debugger. |
2409 SetSourcePosition(expr->position()); | 2415 SetSourcePosition(expr->position()); |
2410 | 2416 |
| 2417 Handle<Object> uninitialized = |
| 2418 TypeFeedbackInfo::UninitializedSentinel(isolate()); |
| 2419 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized); |
2411 __ LoadObject(x2, FeedbackVector()); | 2420 __ LoadObject(x2, FeedbackVector()); |
2412 __ Mov(x3, Operand(Smi::FromInt(expr->CallFeedbackSlot()))); | 2421 __ Mov(x3, Operand(Smi::FromInt(expr->CallFeedbackSlot()))); |
2413 | 2422 |
2414 // Record call targets in unoptimized code. | 2423 // Record call targets in unoptimized code. |
2415 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); | 2424 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); |
2416 __ Peek(x1, (arg_count + 1) * kXRegSize); | 2425 __ Peek(x1, (arg_count + 1) * kXRegSize); |
2417 __ CallStub(&stub); | 2426 __ CallStub(&stub); |
2418 RecordJSReturnSite(expr); | 2427 RecordJSReturnSite(expr); |
2419 // Restore context register. | 2428 // Restore context register. |
2420 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2429 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2597 | 2606 |
2598 // Call the construct call builtin that handles allocation and | 2607 // Call the construct call builtin that handles allocation and |
2599 // constructor invocation. | 2608 // constructor invocation. |
2600 SetSourcePosition(expr->position()); | 2609 SetSourcePosition(expr->position()); |
2601 | 2610 |
2602 // Load function and argument count into x1 and x0. | 2611 // Load function and argument count into x1 and x0. |
2603 __ Mov(x0, arg_count); | 2612 __ Mov(x0, arg_count); |
2604 __ Peek(x1, arg_count * kXRegSize); | 2613 __ Peek(x1, arg_count * kXRegSize); |
2605 | 2614 |
2606 // Record call targets in unoptimized code. | 2615 // Record call targets in unoptimized code. |
| 2616 Handle<Object> uninitialized = |
| 2617 TypeFeedbackInfo::UninitializedSentinel(isolate()); |
| 2618 StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized); |
2607 __ LoadObject(x2, FeedbackVector()); | 2619 __ LoadObject(x2, FeedbackVector()); |
2608 __ Mov(x3, Operand(Smi::FromInt(expr->CallNewFeedbackSlot()))); | 2620 __ Mov(x3, Operand(Smi::FromInt(expr->CallNewFeedbackSlot()))); |
2609 | 2621 |
2610 CallConstructStub stub(RECORD_CALL_TARGET); | 2622 CallConstructStub stub(RECORD_CALL_TARGET); |
2611 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); | 2623 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
2612 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2624 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
2613 context()->Plug(x0); | 2625 context()->Plug(x0); |
2614 } | 2626 } |
2615 | 2627 |
2616 | 2628 |
(...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4967 return previous_; | 4979 return previous_; |
4968 } | 4980 } |
4969 | 4981 |
4970 | 4982 |
4971 #undef __ | 4983 #undef __ |
4972 | 4984 |
4973 | 4985 |
4974 } } // namespace v8::internal | 4986 } } // namespace v8::internal |
4975 | 4987 |
4976 #endif // V8_TARGET_ARCH_A64 | 4988 #endif // V8_TARGET_ARCH_A64 |
OLD | NEW |