Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/deoptimizer.h" | 5 #include "src/deoptimizer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/assembler-inl.h" | 10 #include "src/assembler-inl.h" |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 815 break; | 815 break; |
| 816 case TranslatedFrame::kGetter: | 816 case TranslatedFrame::kGetter: |
| 817 DoComputeAccessorStubFrame(translated_frame, frame_index, false); | 817 DoComputeAccessorStubFrame(translated_frame, frame_index, false); |
| 818 break; | 818 break; |
| 819 case TranslatedFrame::kSetter: | 819 case TranslatedFrame::kSetter: |
| 820 DoComputeAccessorStubFrame(translated_frame, frame_index, true); | 820 DoComputeAccessorStubFrame(translated_frame, frame_index, true); |
| 821 break; | 821 break; |
| 822 case TranslatedFrame::kCompiledStub: | 822 case TranslatedFrame::kCompiledStub: |
| 823 DoComputeCompiledStubFrame(translated_frame, frame_index); | 823 DoComputeCompiledStubFrame(translated_frame, frame_index); |
| 824 break; | 824 break; |
| 825 case TranslatedFrame::kBuiltinContinuation: | |
| 826 DoComputeBuiltinContinuation(translated_frame, frame_index); | |
| 827 break; | |
| 825 case TranslatedFrame::kInvalid: | 828 case TranslatedFrame::kInvalid: |
| 826 FATAL("invalid frame"); | 829 FATAL("invalid frame"); |
| 827 break; | 830 break; |
| 828 } | 831 } |
| 829 } | 832 } |
| 830 | 833 |
| 831 // Print some helpful diagnostic information. | 834 // Print some helpful diagnostic information. |
| 832 if (trace_scope_ != NULL) { | 835 if (trace_scope_ != NULL) { |
| 833 double ms = timer.Elapsed().InMillisecondsF(); | 836 double ms = timer.Elapsed().InMillisecondsF(); |
| 834 int index = output_count_ - 1; // Index of the topmost frame. | 837 int index = output_count_ - 1; // Index of the topmost frame. |
| (...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2143 output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value); | 2146 output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value); |
| 2144 } | 2147 } |
| 2145 output_frame->SetState( | 2148 output_frame->SetState( |
| 2146 Smi::FromInt(static_cast<int>(BailoutState::NO_REGISTERS))); | 2149 Smi::FromInt(static_cast<int>(BailoutState::NO_REGISTERS))); |
| 2147 Code* notify_failure = | 2150 Code* notify_failure = |
| 2148 isolate_->builtins()->builtin(Builtins::kNotifyStubFailureSaveDoubles); | 2151 isolate_->builtins()->builtin(Builtins::kNotifyStubFailureSaveDoubles); |
| 2149 output_frame->SetContinuation( | 2152 output_frame->SetContinuation( |
| 2150 reinterpret_cast<intptr_t>(notify_failure->entry())); | 2153 reinterpret_cast<intptr_t>(notify_failure->entry())); |
| 2151 } | 2154 } |
| 2152 | 2155 |
| 2156 // BuiltinContinuationFrames capture the machine state that is expected as input | |
| 2157 // to a builtin, including both input register values and stack parameters. When | |
| 2158 // the frame is reactivated (i.e. the frame below it returns), a | |
| 2159 // ContinueToBuiltin stub restores the register state from the frame and tail | |
| 2160 // calls to the actual target builtin, making it appear that the stub had been | |
| 2161 // directly called by the frame above it. The input values to populate the frame | |
| 2162 // are taken from the deopt's FrameState. | |
| 2163 // | |
| 2164 // TO | |
| 2165 // | .... | | |
| 2166 // +-------------------------+ | |
| 2167 // | builtin param 0 |<- FrameState input value n becomes | |
| 2168 // +-------------------------+ | |
| 2169 // | ... | | |
| 2170 // +-------------------------+ | |
| 2171 // | builtin param m |<- FrameState input value n+m-1, or in | |
| 2172 // +-------------------------+ the LAZY case, return LAZY result value | |
| 2173 // | ContinueToBuiltin entry | | |
| 2174 // +-------------------------+ | |
| 2175 // | | saved frame (FP) | | |
| 2176 // | +=========================+<- fpreg | |
| 2177 // | |constant pool (if ool_cp)| | |
| 2178 // v +-------------------------+ | |
| 2179 // |BUILTIN_CONTINUATION mark| | |
| 2180 // +-------------------------+ | |
| 2181 // | JS Builtin code object | | |
| 2182 // +-------------------------+ | |
| 2183 // | builtin input GPR reg0 |<- populated from deopt FrameState using | |
| 2184 // +-------------------------+ the builtin's CallInterfaceDescriptor | |
| 2185 // | ... | to map a FrameState's 0..n-1 inputs to | |
| 2186 // +-------------------------+ the builtin's n input register params. | |
| 2187 // | builtin input GPR regn | | |
| 2188 // |-------------------------|<- spreg | |
| 2189 // | |
| 2190 void Deoptimizer::DoComputeBuiltinContinuation( | |
| 2191 TranslatedFrame* translated_frame, int frame_index) { | |
| 2192 TranslatedFrame::iterator value_iterator = translated_frame->begin(); | |
| 2193 int input_index = 0; | |
| 2194 | |
| 2195 // The output frame must have room for all of the parameters that need to be | |
| 2196 // passed to the builtin continuation. | |
| 2197 int height_in_words = translated_frame->height(); | |
| 2198 | |
| 2199 BailoutId bailout_id = translated_frame->node_id(); | |
| 2200 Builtins::Name builtin_name = Builtins::GetBuiltinFromBailoutId(bailout_id); | |
| 2201 Code* builtin = isolate()->builtins()->builtin(builtin_name); | |
| 2202 Callable continuation_callable = | |
| 2203 Builtins::CallableFor(isolate(), builtin_name); | |
| 2204 CallInterfaceDescriptor continuation_descriptor = | |
| 2205 continuation_callable.descriptor(); | |
| 2206 | |
| 2207 bool is_bottommost = (0 == frame_index); | |
| 2208 bool is_topmost = (output_count_ - 1 == frame_index); | |
| 2209 bool must_handle_result = !is_topmost || bailout_type_ == LAZY; | |
| 2210 | |
| 2211 const RegisterConfiguration* config(RegisterConfiguration::Turbofan()); | |
| 2212 int allocatable_register_count = config->num_allocatable_general_registers(); | |
| 2213 int register_parameter_count = | |
| 2214 continuation_descriptor.GetRegisterParameterCount(); | |
| 2215 // Make sure to account for the context by removing it from the register | |
| 2216 // parameter count. | |
| 2217 int stack_param_count = height_in_words - register_parameter_count - 1; | |
| 2218 if (must_handle_result) stack_param_count++; | |
| 2219 int output_frame_size = | |
| 2220 kPointerSize * stack_param_count + | |
| 2221 TYPED_FRAME_SIZE(1 + allocatable_register_count); // For destination | |
| 2222 // builtin code and | |
| 2223 // registers | |
| 2224 if (trace_scope_ != NULL) { | |
| 2225 PrintF(trace_scope_->file(), | |
| 2226 " translating BuiltinContinuation to %s, stack param count %d\n", | |
| 2227 Builtins::name(builtin_name), stack_param_count); | |
| 2228 } | |
| 2229 | |
| 2230 unsigned output_frame_offset = output_frame_size; | |
| 2231 FrameDescription* output_frame = | |
| 2232 new (output_frame_size) FrameDescription(output_frame_size); | |
| 2233 output_[frame_index] = output_frame; | |
| 2234 | |
| 2235 // The top address of the frame is computed from the previous frame's top and | |
| 2236 // this frame's size. | |
| 2237 intptr_t top_address; | |
| 2238 if (is_bottommost) { | |
| 2239 top_address = caller_frame_top_ - output_frame_size; | |
| 2240 } else { | |
| 2241 top_address = output_[frame_index - 1]->GetTop() - output_frame_size; | |
| 2242 } | |
| 2243 output_frame->SetTop(top_address); | |
| 2244 | |
| 2245 output_frame->SetState( | |
| 2246 Smi::FromInt(static_cast<int>(BailoutState::NO_REGISTERS))); | |
| 2247 | |
| 2248 // Get the JSFunction | |
| 2249 Object* maybe_function = value_iterator->GetRawValue(); | |
| 2250 JSFunction* function = JSFunction::cast(maybe_function); | |
| 2251 USE(function); | |
| 2252 ++value_iterator; | |
| 2253 | |
| 2254 std::vector<intptr_t> register_values; | |
| 2255 int total_registers = config->num_general_registers(); | |
| 2256 register_values.reserve(total_registers); | |
| 2257 for (int i = 0; i < total_registers; ++i) { | |
| 2258 register_values[i] = 0; | |
|
Jarin
2017/05/16 20:00:04
I am surprised this works. vector::reserve only re
danno
2017/05/17 10:54:18
Done.
| |
| 2259 } | |
| 2260 | |
| 2261 bool java_script_builtin = false; | |
| 2262 intptr_t value; | |
| 2263 for (int i = 0; i < register_parameter_count; ++i) { | |
| 2264 MachineType type = continuation_descriptor.GetParameterType(i); | |
| 2265 // Only tagged and int32 arguments are supported | |
| 2266 CHECK(IsAnyTagged(type.representation()) || type == MachineType::Int32()); | |
| 2267 int code = continuation_descriptor.GetRegisterParameter(i).code(); | |
| 2268 // An int32 argument is only supported for the arguments count parameter | |
| 2269 // to a JavaScript builtin stub. | |
| 2270 CHECK(type != MachineType::Int32() || | |
| 2271 code == kJavaScriptCallArgCountRegister.code()); | |
| 2272 if (type == MachineType::Int32()) { | |
| 2273 java_script_builtin = true; | |
| 2274 } | |
|
Jarin
2017/05/16 20:00:04
The checking above seems hard to follow. How about
danno
2017/05/17 10:54:18
Done.
| |
| 2275 value = reinterpret_cast<intptr_t>(value_iterator->GetRawValue()); | |
| 2276 register_values[code] = value; | |
| 2277 ++input_index; | |
| 2278 ++value_iterator; | |
| 2279 } | |
| 2280 | |
| 2281 register_values[kContextRegister.code()] = | |
| 2282 reinterpret_cast<intptr_t>(value_iterator->GetRawValue()); | |
| 2283 ++input_index; | |
| 2284 ++value_iterator; | |
| 2285 | |
| 2286 int translated_stack_parameters = | |
| 2287 must_handle_result ? stack_param_count - 1 : stack_param_count; | |
| 2288 | |
| 2289 for (int i = 0; i < translated_stack_parameters; ++i) { | |
| 2290 output_frame_offset -= kPointerSize; | |
| 2291 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, | |
| 2292 output_frame_offset); | |
| 2293 } | |
| 2294 | |
| 2295 if (must_handle_result) { | |
| 2296 output_frame_offset -= kPointerSize; | |
| 2297 WriteValueToOutput(isolate()->heap()->the_hole_value(), input_index, | |
| 2298 frame_index, output_frame_offset, | |
| 2299 "placeholder for return result on lazy deopt "); | |
|
Jarin
2017/05/16 20:00:04
This would deserve a separate paragraph in the com
danno
2017/05/17 10:54:18
Done.
| |
| 2300 ++input_index; | |
| 2301 ++value_iterator; | |
| 2302 } | |
| 2303 | |
| 2304 // Set caller's PC (JSFunction continuation). | |
| 2305 output_frame_offset -= kPCOnStackSize; | |
| 2306 if (is_bottommost) { | |
| 2307 value = caller_pc_; | |
| 2308 } else { | |
| 2309 value = output_[frame_index - 1]->GetPc(); | |
| 2310 } | |
| 2311 output_frame->SetCallerPc(output_frame_offset, value); | |
| 2312 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | |
| 2313 "caller's pc\n"); | |
| 2314 | |
| 2315 // Read caller's FP from the previous frame, and set this frame's FP. | |
| 2316 output_frame_offset -= kFPOnStackSize; | |
| 2317 if (is_bottommost) { | |
| 2318 value = caller_fp_; | |
| 2319 } else { | |
| 2320 value = output_[frame_index - 1]->GetFp(); | |
| 2321 } | |
| 2322 output_frame->SetCallerFp(output_frame_offset, value); | |
| 2323 intptr_t fp_value = top_address + output_frame_offset; | |
| 2324 output_frame->SetFp(fp_value); | |
| 2325 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | |
| 2326 "caller's fp\n"); | |
| 2327 | |
| 2328 if (FLAG_enable_embedded_constant_pool) { | |
| 2329 // Read the caller's constant pool from the previous frame. | |
| 2330 output_frame_offset -= kPointerSize; | |
| 2331 if (is_bottommost) { | |
| 2332 value = caller_constant_pool_; | |
| 2333 } else { | |
| 2334 value = output_[frame_index - 1]->GetConstantPool(); | |
| 2335 } | |
| 2336 output_frame->SetCallerConstantPool(output_frame_offset, value); | |
| 2337 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | |
| 2338 "caller's constant_pool\n"); | |
| 2339 } | |
| 2340 | |
| 2341 // A marker value is used in place of the context. | |
| 2342 output_frame_offset -= kPointerSize; | |
| 2343 intptr_t marker = StackFrame::TypeToMarker(StackFrame::BUILTIN_CONTINUATION); | |
| 2344 output_frame->SetFrameSlot(output_frame_offset, marker); | |
| 2345 DebugPrintOutputSlot(marker, frame_index, output_frame_offset, | |
| 2346 "context (builtin continuation sentinel)\n"); | |
| 2347 | |
| 2348 // The builtin to continue to | |
| 2349 output_frame_offset -= kPointerSize; | |
| 2350 value = reinterpret_cast<intptr_t>(builtin); | |
| 2351 output_frame->SetFrameSlot(output_frame_offset, value); | |
| 2352 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | |
| 2353 "builtin address\n"); | |
| 2354 | |
| 2355 for (int i = 0; i < allocatable_register_count; ++i) { | |
| 2356 output_frame_offset -= kPointerSize; | |
| 2357 int code = config->GetAllocatableGeneralCode(i); | |
| 2358 value = reinterpret_cast<intptr_t>(register_values[code]); | |
| 2359 output_frame->SetFrameSlot(output_frame_offset, value); | |
| 2360 if (trace_scope_ != nullptr) { | |
| 2361 ScopedVector<char> str(128); | |
| 2362 if (java_script_builtin && | |
| 2363 code == kJavaScriptCallArgCountRegister.code()) { | |
| 2364 SNPrintF( | |
| 2365 str, | |
| 2366 "tagged argument count %s (will be untagged by continuation)\n", | |
| 2367 config->GetGeneralRegisterName(code)); | |
| 2368 } else { | |
| 2369 SNPrintF(str, "builtin register argument %s\n", | |
| 2370 config->GetGeneralRegisterName(code)); | |
| 2371 } | |
| 2372 DebugPrintOutputSlot(value, frame_index, output_frame_offset, | |
| 2373 str.start()); | |
| 2374 } | |
| 2375 } | |
| 2376 | |
| 2377 // Ensure the frame pointer register points to the callee's frame. The builtin | |
| 2378 // will build its own frame once we continue to it. | |
| 2379 Register fp_reg = JavaScriptFrame::fp_register(); | |
| 2380 output_frame->SetRegister(fp_reg.code(), output_[frame_index - 1]->GetFp()); | |
| 2381 | |
| 2382 CHECK(java_script_builtin); | |
| 2383 Code* continue_to_builtin = | |
| 2384 must_handle_result ? isolate()->builtins()->builtin( | |
| 2385 Builtins::kContinueToJavaScriptBuiltinWithResult) | |
| 2386 : isolate()->builtins()->builtin( | |
| 2387 Builtins::kContinueToJavaScriptBuiltin); | |
| 2388 output_frame->SetPc( | |
| 2389 reinterpret_cast<intptr_t>(continue_to_builtin->instruction_start())); | |
| 2390 | |
| 2391 Code* continuation = | |
| 2392 isolate()->builtins()->builtin(Builtins::kNotifyBuiltinContinuation); | |
| 2393 output_frame->SetContinuation( | |
| 2394 reinterpret_cast<intptr_t>(continuation->entry())); | |
| 2395 } | |
| 2153 | 2396 |
| 2154 void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) { | 2397 void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) { |
| 2155 // Walk to the last JavaScript output frame to find out if it has | 2398 // Walk to the last JavaScript output frame to find out if it has |
| 2156 // adapted arguments. | 2399 // adapted arguments. |
| 2157 for (int frame_index = 0; frame_index < jsframe_count(); ++frame_index) { | 2400 for (int frame_index = 0; frame_index < jsframe_count(); ++frame_index) { |
| 2158 if (frame_index != 0) it->Advance(); | 2401 if (frame_index != 0) it->Advance(); |
| 2159 } | 2402 } |
| 2160 translated_state_.Prepare(it->frame()->has_adapted_arguments(), | 2403 translated_state_.Prepare(it->frame()->has_adapted_arguments(), |
| 2161 reinterpret_cast<Address>(stack_fp_)); | 2404 reinterpret_cast<Address>(stack_fp_)); |
| 2162 | 2405 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2381 return is_negative ? -result : result; | 2624 return is_negative ? -result : result; |
| 2382 } | 2625 } |
| 2383 | 2626 |
| 2384 | 2627 |
| 2385 Handle<ByteArray> TranslationBuffer::CreateByteArray(Factory* factory) { | 2628 Handle<ByteArray> TranslationBuffer::CreateByteArray(Factory* factory) { |
| 2386 Handle<ByteArray> result = factory->NewByteArray(CurrentIndex(), TENURED); | 2629 Handle<ByteArray> result = factory->NewByteArray(CurrentIndex(), TENURED); |
| 2387 contents_.CopyTo(result->GetDataStartAddress()); | 2630 contents_.CopyTo(result->GetDataStartAddress()); |
| 2388 return result; | 2631 return result; |
| 2389 } | 2632 } |
| 2390 | 2633 |
| 2634 void Translation::BeginBuiltinContinuationFrame(BailoutId bailout_id, | |
| 2635 int literal_id, | |
| 2636 unsigned height) { | |
| 2637 buffer_->Add(BUILTIN_CONTINUATION_FRAME); | |
| 2638 buffer_->Add(bailout_id.ToInt()); | |
| 2639 buffer_->Add(literal_id); | |
| 2640 buffer_->Add(height); | |
| 2641 } | |
| 2642 | |
| 2391 void Translation::BeginConstructStubFrame(BailoutId bailout_id, int literal_id, | 2643 void Translation::BeginConstructStubFrame(BailoutId bailout_id, int literal_id, |
| 2392 unsigned height) { | 2644 unsigned height) { |
| 2393 buffer_->Add(CONSTRUCT_STUB_FRAME); | 2645 buffer_->Add(CONSTRUCT_STUB_FRAME); |
| 2394 buffer_->Add(bailout_id.ToInt()); | 2646 buffer_->Add(bailout_id.ToInt()); |
| 2395 buffer_->Add(literal_id); | 2647 buffer_->Add(literal_id); |
| 2396 buffer_->Add(height); | 2648 buffer_->Add(height); |
| 2397 } | 2649 } |
| 2398 | 2650 |
| 2399 | 2651 |
| 2400 void Translation::BeginGetterStubFrame(int literal_id) { | 2652 void Translation::BeginGetterStubFrame(int literal_id) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2583 case LITERAL: | 2835 case LITERAL: |
| 2584 case COMPILED_STUB_FRAME: | 2836 case COMPILED_STUB_FRAME: |
| 2585 case TAIL_CALLER_FRAME: | 2837 case TAIL_CALLER_FRAME: |
| 2586 return 1; | 2838 return 1; |
| 2587 case BEGIN: | 2839 case BEGIN: |
| 2588 case ARGUMENTS_ADAPTOR_FRAME: | 2840 case ARGUMENTS_ADAPTOR_FRAME: |
| 2589 return 2; | 2841 return 2; |
| 2590 case JS_FRAME: | 2842 case JS_FRAME: |
| 2591 case INTERPRETED_FRAME: | 2843 case INTERPRETED_FRAME: |
| 2592 case CONSTRUCT_STUB_FRAME: | 2844 case CONSTRUCT_STUB_FRAME: |
| 2845 case BUILTIN_CONTINUATION_FRAME: | |
| 2593 return 3; | 2846 return 3; |
| 2594 case ARGUMENTS_ELEMENTS: | 2847 case ARGUMENTS_ELEMENTS: |
| 2595 case ARGUMENTS_LENGTH: | 2848 case ARGUMENTS_LENGTH: |
| 2596 return 1; | 2849 return 1; |
| 2597 } | 2850 } |
| 2598 FATAL("Unexpected translation type"); | 2851 FATAL("Unexpected translation type"); |
| 2599 return -1; | 2852 return -1; |
| 2600 } | 2853 } |
| 2601 | 2854 |
| 2602 | 2855 |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3190 } | 3443 } |
| 3191 | 3444 |
| 3192 TranslatedFrame TranslatedFrame::ConstructStubFrame( | 3445 TranslatedFrame TranslatedFrame::ConstructStubFrame( |
| 3193 BailoutId bailout_id, SharedFunctionInfo* shared_info, int height) { | 3446 BailoutId bailout_id, SharedFunctionInfo* shared_info, int height) { |
| 3194 TranslatedFrame frame(kConstructStub, shared_info->GetIsolate(), shared_info, | 3447 TranslatedFrame frame(kConstructStub, shared_info->GetIsolate(), shared_info, |
| 3195 height); | 3448 height); |
| 3196 frame.node_id_ = bailout_id; | 3449 frame.node_id_ = bailout_id; |
| 3197 return frame; | 3450 return frame; |
| 3198 } | 3451 } |
| 3199 | 3452 |
| 3453 TranslatedFrame TranslatedFrame::BuiltinContinuationFrame( | |
| 3454 BailoutId bailout_id, SharedFunctionInfo* shared_info, int height) { | |
| 3455 TranslatedFrame frame(kBuiltinContinuation, shared_info->GetIsolate(), | |
| 3456 shared_info, height); | |
| 3457 frame.node_id_ = bailout_id; | |
| 3458 return frame; | |
| 3459 } | |
| 3200 | 3460 |
| 3201 int TranslatedFrame::GetValueCount() { | 3461 int TranslatedFrame::GetValueCount() { |
| 3202 switch (kind()) { | 3462 switch (kind()) { |
| 3203 case kFunction: { | 3463 case kFunction: { |
| 3204 int parameter_count = | 3464 int parameter_count = |
| 3205 raw_shared_info_->internal_formal_parameter_count() + 1; | 3465 raw_shared_info_->internal_formal_parameter_count() + 1; |
| 3206 // + 1 for function. | 3466 // + 1 for function. |
| 3207 return height_ + parameter_count + 1; | 3467 return height_ + parameter_count + 1; |
| 3208 } | 3468 } |
| 3209 | 3469 |
| 3210 case kInterpretedFunction: { | 3470 case kInterpretedFunction: { |
| 3211 int parameter_count = | 3471 int parameter_count = |
| 3212 raw_shared_info_->internal_formal_parameter_count() + 1; | 3472 raw_shared_info_->internal_formal_parameter_count() + 1; |
| 3213 // + 2 for function and context. | 3473 // + 2 for function and context. |
| 3214 return height_ + parameter_count + 2; | 3474 return height_ + parameter_count + 2; |
| 3215 } | 3475 } |
| 3216 | 3476 |
| 3217 case kGetter: | 3477 case kGetter: |
| 3218 return 2; // Function and receiver. | 3478 return 2; // Function and receiver. |
| 3219 | 3479 |
| 3220 case kSetter: | 3480 case kSetter: |
| 3221 return 3; // Function, receiver and the value to set. | 3481 return 3; // Function, receiver and the value to set. |
| 3222 | 3482 |
| 3223 case kArgumentsAdaptor: | 3483 case kArgumentsAdaptor: |
| 3224 case kConstructStub: | 3484 case kConstructStub: |
| 3485 case kBuiltinContinuation: | |
| 3225 return 1 + height_; | 3486 return 1 + height_; |
| 3226 | 3487 |
| 3227 case kTailCallerFunction: | 3488 case kTailCallerFunction: |
| 3228 return 1; // Function. | 3489 return 1; // Function. |
| 3229 | 3490 |
| 3230 case kCompiledStub: | 3491 case kCompiledStub: |
| 3231 return height_; | 3492 return height_; |
| 3232 | 3493 |
| 3233 case kInvalid: | 3494 case kInvalid: |
| 3234 UNREACHABLE(); | 3495 UNREACHABLE(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3319 if (trace_file != nullptr) { | 3580 if (trace_file != nullptr) { |
| 3320 std::unique_ptr<char[]> name = shared_info->DebugName()->ToCString(); | 3581 std::unique_ptr<char[]> name = shared_info->DebugName()->ToCString(); |
| 3321 PrintF(trace_file, " reading construct stub frame %s", name.get()); | 3582 PrintF(trace_file, " reading construct stub frame %s", name.get()); |
| 3322 PrintF(trace_file, " => bailout_id=%d, height=%d; inputs:\n", | 3583 PrintF(trace_file, " => bailout_id=%d, height=%d; inputs:\n", |
| 3323 bailout_id.ToInt(), height); | 3584 bailout_id.ToInt(), height); |
| 3324 } | 3585 } |
| 3325 return TranslatedFrame::ConstructStubFrame(bailout_id, shared_info, | 3586 return TranslatedFrame::ConstructStubFrame(bailout_id, shared_info, |
| 3326 height); | 3587 height); |
| 3327 } | 3588 } |
| 3328 | 3589 |
| 3590 case Translation::BUILTIN_CONTINUATION_FRAME: { | |
| 3591 BailoutId bailout_id = BailoutId(iterator->Next()); | |
| 3592 SharedFunctionInfo* shared_info = | |
| 3593 SharedFunctionInfo::cast(literal_array->get(iterator->Next())); | |
| 3594 int height = iterator->Next(); | |
| 3595 if (trace_file != nullptr) { | |
| 3596 std::unique_ptr<char[]> name = shared_info->DebugName()->ToCString(); | |
| 3597 PrintF(trace_file, " reading builtin continuation frame %s", | |
| 3598 name.get()); | |
| 3599 PrintF(trace_file, " => bailout_id=%d, height=%d; inputs:\n", | |
| 3600 bailout_id.ToInt(), height); | |
| 3601 } | |
| 3602 return TranslatedFrame::BuiltinContinuationFrame(bailout_id, shared_info, | |
| 3603 height); | |
| 3604 } | |
| 3605 | |
| 3329 case Translation::GETTER_STUB_FRAME: { | 3606 case Translation::GETTER_STUB_FRAME: { |
| 3330 SharedFunctionInfo* shared_info = | 3607 SharedFunctionInfo* shared_info = |
| 3331 SharedFunctionInfo::cast(literal_array->get(iterator->Next())); | 3608 SharedFunctionInfo::cast(literal_array->get(iterator->Next())); |
| 3332 if (trace_file != nullptr) { | 3609 if (trace_file != nullptr) { |
| 3333 std::unique_ptr<char[]> name = shared_info->DebugName()->ToCString(); | 3610 std::unique_ptr<char[]> name = shared_info->DebugName()->ToCString(); |
| 3334 PrintF(trace_file, " reading getter frame %s; inputs:\n", name.get()); | 3611 PrintF(trace_file, " reading getter frame %s; inputs:\n", name.get()); |
| 3335 } | 3612 } |
| 3336 return TranslatedFrame::AccessorFrame(TranslatedFrame::kGetter, | 3613 return TranslatedFrame::AccessorFrame(TranslatedFrame::kGetter, |
| 3337 shared_info); | 3614 shared_info); |
| 3338 } | 3615 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3487 switch (opcode) { | 3764 switch (opcode) { |
| 3488 case Translation::BEGIN: | 3765 case Translation::BEGIN: |
| 3489 case Translation::JS_FRAME: | 3766 case Translation::JS_FRAME: |
| 3490 case Translation::INTERPRETED_FRAME: | 3767 case Translation::INTERPRETED_FRAME: |
| 3491 case Translation::ARGUMENTS_ADAPTOR_FRAME: | 3768 case Translation::ARGUMENTS_ADAPTOR_FRAME: |
| 3492 case Translation::TAIL_CALLER_FRAME: | 3769 case Translation::TAIL_CALLER_FRAME: |
| 3493 case Translation::CONSTRUCT_STUB_FRAME: | 3770 case Translation::CONSTRUCT_STUB_FRAME: |
| 3494 case Translation::GETTER_STUB_FRAME: | 3771 case Translation::GETTER_STUB_FRAME: |
| 3495 case Translation::SETTER_STUB_FRAME: | 3772 case Translation::SETTER_STUB_FRAME: |
| 3496 case Translation::COMPILED_STUB_FRAME: | 3773 case Translation::COMPILED_STUB_FRAME: |
| 3774 case Translation::BUILTIN_CONTINUATION_FRAME: | |
| 3497 // Peeled off before getting here. | 3775 // Peeled off before getting here. |
| 3498 break; | 3776 break; |
| 3499 | 3777 |
| 3500 case Translation::DUPLICATED_OBJECT: { | 3778 case Translation::DUPLICATED_OBJECT: { |
| 3501 int object_id = iterator->Next(); | 3779 int object_id = iterator->Next(); |
| 3502 if (trace_file != nullptr) { | 3780 if (trace_file != nullptr) { |
| 3503 PrintF(trace_file, "duplicated object #%d", object_id); | 3781 PrintF(trace_file, "duplicated object #%d", object_id); |
| 3504 } | 3782 } |
| 3505 object_positions_.push_back(object_positions_[object_id]); | 3783 object_positions_.push_back(object_positions_[object_id]); |
| 3506 TranslatedValue translated_value = | 3784 TranslatedValue translated_value = |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4467 CHECK(value_info->IsMaterializedObject()); | 4745 CHECK(value_info->IsMaterializedObject()); |
| 4468 | 4746 |
| 4469 value_info->value_ = | 4747 value_info->value_ = |
| 4470 Handle<Object>(previously_materialized_objects->get(i), isolate_); | 4748 Handle<Object>(previously_materialized_objects->get(i), isolate_); |
| 4471 } | 4749 } |
| 4472 } | 4750 } |
| 4473 } | 4751 } |
| 4474 | 4752 |
| 4475 } // namespace internal | 4753 } // namespace internal |
| 4476 } // namespace v8 | 4754 } // namespace v8 |
| OLD | NEW |