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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 break; | 820 break; |
821 case TranslatedFrame::kGetter: | 821 case TranslatedFrame::kGetter: |
822 DoComputeAccessorStubFrame(translated_frame, frame_index, false); | 822 DoComputeAccessorStubFrame(translated_frame, frame_index, false); |
823 break; | 823 break; |
824 case TranslatedFrame::kSetter: | 824 case TranslatedFrame::kSetter: |
825 DoComputeAccessorStubFrame(translated_frame, frame_index, true); | 825 DoComputeAccessorStubFrame(translated_frame, frame_index, true); |
826 break; | 826 break; |
827 case TranslatedFrame::kCompiledStub: | 827 case TranslatedFrame::kCompiledStub: |
828 DoComputeCompiledStubFrame(translated_frame, frame_index); | 828 DoComputeCompiledStubFrame(translated_frame, frame_index); |
829 break; | 829 break; |
| 830 case TranslatedFrame::kBuiltinContinuation: |
| 831 DoComputeBuiltinContinuation(translated_frame, frame_index); |
| 832 break; |
830 case TranslatedFrame::kInvalid: | 833 case TranslatedFrame::kInvalid: |
831 FATAL("invalid frame"); | 834 FATAL("invalid frame"); |
832 break; | 835 break; |
833 } | 836 } |
834 } | 837 } |
835 | 838 |
836 // Print some helpful diagnostic information. | 839 // Print some helpful diagnostic information. |
837 if (trace_scope_ != NULL) { | 840 if (trace_scope_ != NULL) { |
838 double ms = timer.Elapsed().InMillisecondsF(); | 841 double ms = timer.Elapsed().InMillisecondsF(); |
839 int index = output_count_ - 1; // Index of the topmost frame. | 842 int index = output_count_ - 1; // Index of the topmost frame. |
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value); | 2157 output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value); |
2155 } | 2158 } |
2156 output_frame->SetState( | 2159 output_frame->SetState( |
2157 Smi::FromInt(static_cast<int>(BailoutState::NO_REGISTERS))); | 2160 Smi::FromInt(static_cast<int>(BailoutState::NO_REGISTERS))); |
2158 Code* notify_failure = | 2161 Code* notify_failure = |
2159 isolate_->builtins()->builtin(Builtins::kNotifyStubFailureSaveDoubles); | 2162 isolate_->builtins()->builtin(Builtins::kNotifyStubFailureSaveDoubles); |
2160 output_frame->SetContinuation( | 2163 output_frame->SetContinuation( |
2161 reinterpret_cast<intptr_t>(notify_failure->entry())); | 2164 reinterpret_cast<intptr_t>(notify_failure->entry())); |
2162 } | 2165 } |
2163 | 2166 |
| 2167 // BuiltinContinuationFrames capture the machine state that is expected as input |
| 2168 // to a builtin, including both input register values and stack parameters. When |
| 2169 // the frame is reactivated (i.e. the frame below it returns), a |
| 2170 // ContinueToBuiltin stub restores the register state from the frame and tail |
| 2171 // calls to the actual target builtin, making it appear that the stub had been |
| 2172 // directly called by the frame above it. The input values to populate the frame |
| 2173 // are taken from the deopt's FrameState. |
| 2174 // |
| 2175 // Frame translation happens in two modes, EAGER and LAZY. In EAGER mode, all of |
| 2176 // the parameters to the Builtin are explicitly specified in the TurboFan |
| 2177 // FrameState node. In LAZY mode, there is always one fewer parameters specified |
| 2178 // in the FrameState than expected by the Builtin. In that case, construction of |
| 2179 // BuiltinContinuationFrame adds the final missing parameter during |
| 2180 // deoptimization, and that parameter is always on the stack and contains the |
| 2181 // value returned from the callee of the call site triggering the LAZY deopt |
| 2182 // (e.g. rax on x64). This requires that continuation Builtins for LAZY deopts |
| 2183 // must have at least one stack parameter. |
| 2184 // |
| 2185 // TO |
| 2186 // | .... | |
| 2187 // +-------------------------+ |
| 2188 // | builtin param 0 |<- FrameState input value n becomes |
| 2189 // +-------------------------+ |
| 2190 // | ... | |
| 2191 // +-------------------------+ |
| 2192 // | builtin param m |<- FrameState input value n+m-1, or in |
| 2193 // +-------------------------+ the LAZY case, return LAZY result value |
| 2194 // | ContinueToBuiltin entry | |
| 2195 // +-------------------------+ |
| 2196 // | | saved frame (FP) | |
| 2197 // | +=========================+<- fpreg |
| 2198 // | |constant pool (if ool_cp)| |
| 2199 // v +-------------------------+ |
| 2200 // |BUILTIN_CONTINUATION mark| |
| 2201 // +-------------------------+ |
| 2202 // | JS Builtin code object | |
| 2203 // +-------------------------+ |
| 2204 // | builtin input GPR reg0 |<- populated from deopt FrameState using |
| 2205 // +-------------------------+ the builtin's CallInterfaceDescriptor |
| 2206 // | ... | to map a FrameState's 0..n-1 inputs to |
| 2207 // +-------------------------+ the builtin's n input register params. |
| 2208 // | builtin input GPR regn | |
| 2209 // |-------------------------|<- spreg |
| 2210 // |
| 2211 void Deoptimizer::DoComputeBuiltinContinuation( |
| 2212 TranslatedFrame* translated_frame, int frame_index) { |
| 2213 TranslatedFrame::iterator value_iterator = translated_frame->begin(); |
| 2214 int input_index = 0; |
| 2215 |
| 2216 // The output frame must have room for all of the parameters that need to be |
| 2217 // passed to the builtin continuation. |
| 2218 int height_in_words = translated_frame->height(); |
| 2219 |
| 2220 BailoutId bailout_id = translated_frame->node_id(); |
| 2221 Builtins::Name builtin_name = Builtins::GetBuiltinFromBailoutId(bailout_id); |
| 2222 Code* builtin = isolate()->builtins()->builtin(builtin_name); |
| 2223 Callable continuation_callable = |
| 2224 Builtins::CallableFor(isolate(), builtin_name); |
| 2225 CallInterfaceDescriptor continuation_descriptor = |
| 2226 continuation_callable.descriptor(); |
| 2227 |
| 2228 bool is_bottommost = (0 == frame_index); |
| 2229 bool is_topmost = (output_count_ - 1 == frame_index); |
| 2230 bool must_handle_result = !is_topmost || bailout_type_ == LAZY; |
| 2231 |
| 2232 const RegisterConfiguration* config(RegisterConfiguration::Turbofan()); |
| 2233 int allocatable_register_count = config->num_allocatable_general_registers(); |
| 2234 int register_parameter_count = |
| 2235 continuation_descriptor.GetRegisterParameterCount(); |
| 2236 // Make sure to account for the context by removing it from the register |
| 2237 // parameter count. |
| 2238 int stack_param_count = height_in_words - register_parameter_count - 1; |
| 2239 if (must_handle_result) stack_param_count++; |
| 2240 int output_frame_size = |
| 2241 kPointerSize * stack_param_count + |
| 2242 TYPED_FRAME_SIZE(1 + allocatable_register_count); // For destination |
| 2243 // builtin code and |
| 2244 // registers |
| 2245 if (trace_scope_ != NULL) { |
| 2246 PrintF(trace_scope_->file(), |
| 2247 " translating BuiltinContinuation to %s, stack param count %d\n", |
| 2248 Builtins::name(builtin_name), stack_param_count); |
| 2249 } |
| 2250 |
| 2251 unsigned output_frame_offset = output_frame_size; |
| 2252 FrameDescription* output_frame = |
| 2253 new (output_frame_size) FrameDescription(output_frame_size); |
| 2254 output_[frame_index] = output_frame; |
| 2255 |
| 2256 // The top address of the frame is computed from the previous frame's top and |
| 2257 // this frame's size. |
| 2258 intptr_t top_address; |
| 2259 if (is_bottommost) { |
| 2260 top_address = caller_frame_top_ - output_frame_size; |
| 2261 } else { |
| 2262 top_address = output_[frame_index - 1]->GetTop() - output_frame_size; |
| 2263 } |
| 2264 output_frame->SetTop(top_address); |
| 2265 |
| 2266 output_frame->SetState( |
| 2267 Smi::FromInt(static_cast<int>(BailoutState::NO_REGISTERS))); |
| 2268 |
| 2269 // Get (and ignore) the JSFunction |
| 2270 (void)value_iterator->GetRawValue(); |
| 2271 ++value_iterator; |
| 2272 |
| 2273 std::vector<intptr_t> register_values; |
| 2274 int total_registers = config->num_general_registers(); |
| 2275 register_values.resize(total_registers, 0); |
| 2276 for (int i = 0; i < total_registers; ++i) { |
| 2277 register_values[i] = 0; |
| 2278 } |
| 2279 |
| 2280 bool java_script_builtin = false; |
| 2281 intptr_t value; |
| 2282 for (int i = 0; i < register_parameter_count; ++i) { |
| 2283 MachineType type = continuation_descriptor.GetParameterType(i); |
| 2284 int code = continuation_descriptor.GetRegisterParameter(i).code(); |
| 2285 // Only tagged and int32 arguments are supported, and int32 only for the |
| 2286 // arguments count on JavaScript builtins. |
| 2287 if (type == MachineType::Int32()) { |
| 2288 CHECK_EQ(code, kJavaScriptCallArgCountRegister.code()); |
| 2289 java_script_builtin = true; |
| 2290 } else { |
| 2291 // Any other argument must be a tagged value. |
| 2292 CHECK(IsAnyTagged(type.representation())); |
| 2293 } |
| 2294 value = reinterpret_cast<intptr_t>(value_iterator->GetRawValue()); |
| 2295 register_values[code] = value; |
| 2296 ++input_index; |
| 2297 ++value_iterator; |
| 2298 } |
| 2299 |
| 2300 value = reinterpret_cast<intptr_t>(value_iterator->GetRawValue()); |
| 2301 register_values[kContextRegister.code()] = value; |
| 2302 output_frame->SetContext(value); |
| 2303 output_frame->SetRegister(kContextRegister.code(), value); |
| 2304 ++input_index; |
| 2305 ++value_iterator; |
| 2306 |
| 2307 int translated_stack_parameters = |
| 2308 must_handle_result ? stack_param_count - 1 : stack_param_count; |
| 2309 |
| 2310 for (int i = 0; i < translated_stack_parameters; ++i) { |
| 2311 output_frame_offset -= kPointerSize; |
| 2312 WriteTranslatedValueToOutput(&value_iterator, &input_index, frame_index, |
| 2313 output_frame_offset); |
| 2314 } |
| 2315 |
| 2316 if (must_handle_result) { |
| 2317 output_frame_offset -= kPointerSize; |
| 2318 WriteValueToOutput(isolate()->heap()->the_hole_value(), input_index, |
| 2319 frame_index, output_frame_offset, |
| 2320 "placeholder for return result on lazy deopt "); |
| 2321 } |
| 2322 |
| 2323 // Set caller's PC (JSFunction continuation). |
| 2324 output_frame_offset -= kPCOnStackSize; |
| 2325 if (is_bottommost) { |
| 2326 value = caller_pc_; |
| 2327 } else { |
| 2328 value = output_[frame_index - 1]->GetPc(); |
| 2329 } |
| 2330 output_frame->SetCallerPc(output_frame_offset, value); |
| 2331 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 2332 "caller's pc\n"); |
| 2333 |
| 2334 // Read caller's FP from the previous frame, and set this frame's FP. |
| 2335 output_frame_offset -= kFPOnStackSize; |
| 2336 if (is_bottommost) { |
| 2337 value = caller_fp_; |
| 2338 } else { |
| 2339 value = output_[frame_index - 1]->GetFp(); |
| 2340 } |
| 2341 output_frame->SetCallerFp(output_frame_offset, value); |
| 2342 intptr_t fp_value = top_address + output_frame_offset; |
| 2343 output_frame->SetFp(fp_value); |
| 2344 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 2345 "caller's fp\n"); |
| 2346 |
| 2347 if (FLAG_enable_embedded_constant_pool) { |
| 2348 // Read the caller's constant pool from the previous frame. |
| 2349 output_frame_offset -= kPointerSize; |
| 2350 if (is_bottommost) { |
| 2351 value = caller_constant_pool_; |
| 2352 } else { |
| 2353 value = output_[frame_index - 1]->GetConstantPool(); |
| 2354 } |
| 2355 output_frame->SetCallerConstantPool(output_frame_offset, value); |
| 2356 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 2357 "caller's constant_pool\n"); |
| 2358 } |
| 2359 |
| 2360 // A marker value is used in place of the context. |
| 2361 output_frame_offset -= kPointerSize; |
| 2362 intptr_t marker = StackFrame::TypeToMarker(StackFrame::BUILTIN_CONTINUATION); |
| 2363 output_frame->SetFrameSlot(output_frame_offset, marker); |
| 2364 DebugPrintOutputSlot(marker, frame_index, output_frame_offset, |
| 2365 "context (builtin continuation sentinel)\n"); |
| 2366 |
| 2367 // The builtin to continue to |
| 2368 output_frame_offset -= kPointerSize; |
| 2369 value = reinterpret_cast<intptr_t>(builtin); |
| 2370 output_frame->SetFrameSlot(output_frame_offset, value); |
| 2371 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 2372 "builtin address\n"); |
| 2373 |
| 2374 for (int i = 0; i < allocatable_register_count; ++i) { |
| 2375 output_frame_offset -= kPointerSize; |
| 2376 int code = config->GetAllocatableGeneralCode(i); |
| 2377 value = register_values[code]; |
| 2378 output_frame->SetFrameSlot(output_frame_offset, value); |
| 2379 if (trace_scope_ != nullptr) { |
| 2380 ScopedVector<char> str(128); |
| 2381 if (java_script_builtin && |
| 2382 code == kJavaScriptCallArgCountRegister.code()) { |
| 2383 SNPrintF( |
| 2384 str, |
| 2385 "tagged argument count %s (will be untagged by continuation)\n", |
| 2386 config->GetGeneralRegisterName(code)); |
| 2387 } else { |
| 2388 SNPrintF(str, "builtin register argument %s\n", |
| 2389 config->GetGeneralRegisterName(code)); |
| 2390 } |
| 2391 DebugPrintOutputSlot(value, frame_index, output_frame_offset, |
| 2392 str.start()); |
| 2393 } |
| 2394 } |
| 2395 |
| 2396 // Ensure the frame pointer register points to the callee's frame. The builtin |
| 2397 // will build its own frame once we continue to it. |
| 2398 Register fp_reg = JavaScriptFrame::fp_register(); |
| 2399 output_frame->SetRegister(fp_reg.code(), output_[frame_index - 1]->GetFp()); |
| 2400 |
| 2401 Code* continue_to_builtin = |
| 2402 java_script_builtin |
| 2403 ? (must_handle_result |
| 2404 ? isolate()->builtins()->builtin( |
| 2405 Builtins::kContinueToJavaScriptBuiltinWithResult) |
| 2406 : isolate()->builtins()->builtin( |
| 2407 Builtins::kContinueToJavaScriptBuiltin)) |
| 2408 : (must_handle_result |
| 2409 ? isolate()->builtins()->builtin( |
| 2410 Builtins::kContinueToCodeStubBuiltinWithResult) |
| 2411 : isolate()->builtins()->builtin( |
| 2412 Builtins::kContinueToCodeStubBuiltin)); |
| 2413 output_frame->SetPc( |
| 2414 reinterpret_cast<intptr_t>(continue_to_builtin->instruction_start())); |
| 2415 |
| 2416 Code* continuation = |
| 2417 isolate()->builtins()->builtin(Builtins::kNotifyBuiltinContinuation); |
| 2418 output_frame->SetContinuation( |
| 2419 reinterpret_cast<intptr_t>(continuation->entry())); |
| 2420 } |
2164 | 2421 |
2165 void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) { | 2422 void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) { |
2166 // Walk to the last JavaScript output frame to find out if it has | 2423 // Walk to the last JavaScript output frame to find out if it has |
2167 // adapted arguments. | 2424 // adapted arguments. |
2168 for (int frame_index = 0; frame_index < jsframe_count(); ++frame_index) { | 2425 for (int frame_index = 0; frame_index < jsframe_count(); ++frame_index) { |
2169 if (frame_index != 0) it->Advance(); | 2426 if (frame_index != 0) it->Advance(); |
2170 } | 2427 } |
2171 translated_state_.Prepare(it->frame()->has_adapted_arguments(), | 2428 translated_state_.Prepare(it->frame()->has_adapted_arguments(), |
2172 reinterpret_cast<Address>(stack_fp_)); | 2429 reinterpret_cast<Address>(stack_fp_)); |
2173 | 2430 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2398 return is_negative ? -result : result; | 2655 return is_negative ? -result : result; |
2399 } | 2656 } |
2400 | 2657 |
2401 | 2658 |
2402 Handle<ByteArray> TranslationBuffer::CreateByteArray(Factory* factory) { | 2659 Handle<ByteArray> TranslationBuffer::CreateByteArray(Factory* factory) { |
2403 Handle<ByteArray> result = factory->NewByteArray(CurrentIndex(), TENURED); | 2660 Handle<ByteArray> result = factory->NewByteArray(CurrentIndex(), TENURED); |
2404 contents_.CopyTo(result->GetDataStartAddress()); | 2661 contents_.CopyTo(result->GetDataStartAddress()); |
2405 return result; | 2662 return result; |
2406 } | 2663 } |
2407 | 2664 |
| 2665 void Translation::BeginBuiltinContinuationFrame(BailoutId bailout_id, |
| 2666 int literal_id, |
| 2667 unsigned height) { |
| 2668 buffer_->Add(BUILTIN_CONTINUATION_FRAME); |
| 2669 buffer_->Add(bailout_id.ToInt()); |
| 2670 buffer_->Add(literal_id); |
| 2671 buffer_->Add(height); |
| 2672 } |
| 2673 |
2408 void Translation::BeginConstructStubFrame(BailoutId bailout_id, int literal_id, | 2674 void Translation::BeginConstructStubFrame(BailoutId bailout_id, int literal_id, |
2409 unsigned height) { | 2675 unsigned height) { |
2410 buffer_->Add(CONSTRUCT_STUB_FRAME); | 2676 buffer_->Add(CONSTRUCT_STUB_FRAME); |
2411 buffer_->Add(bailout_id.ToInt()); | 2677 buffer_->Add(bailout_id.ToInt()); |
2412 buffer_->Add(literal_id); | 2678 buffer_->Add(literal_id); |
2413 buffer_->Add(height); | 2679 buffer_->Add(height); |
2414 } | 2680 } |
2415 | 2681 |
2416 | 2682 |
2417 void Translation::BeginGetterStubFrame(int literal_id) { | 2683 void Translation::BeginGetterStubFrame(int literal_id) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2600 case LITERAL: | 2866 case LITERAL: |
2601 case COMPILED_STUB_FRAME: | 2867 case COMPILED_STUB_FRAME: |
2602 case TAIL_CALLER_FRAME: | 2868 case TAIL_CALLER_FRAME: |
2603 return 1; | 2869 return 1; |
2604 case BEGIN: | 2870 case BEGIN: |
2605 case ARGUMENTS_ADAPTOR_FRAME: | 2871 case ARGUMENTS_ADAPTOR_FRAME: |
2606 return 2; | 2872 return 2; |
2607 case JS_FRAME: | 2873 case JS_FRAME: |
2608 case INTERPRETED_FRAME: | 2874 case INTERPRETED_FRAME: |
2609 case CONSTRUCT_STUB_FRAME: | 2875 case CONSTRUCT_STUB_FRAME: |
| 2876 case BUILTIN_CONTINUATION_FRAME: |
2610 return 3; | 2877 return 3; |
2611 case ARGUMENTS_ELEMENTS: | 2878 case ARGUMENTS_ELEMENTS: |
2612 case ARGUMENTS_LENGTH: | 2879 case ARGUMENTS_LENGTH: |
2613 return 1; | 2880 return 1; |
2614 } | 2881 } |
2615 FATAL("Unexpected translation type"); | 2882 FATAL("Unexpected translation type"); |
2616 return -1; | 2883 return -1; |
2617 } | 2884 } |
2618 | 2885 |
2619 | 2886 |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3207 } | 3474 } |
3208 | 3475 |
3209 TranslatedFrame TranslatedFrame::ConstructStubFrame( | 3476 TranslatedFrame TranslatedFrame::ConstructStubFrame( |
3210 BailoutId bailout_id, SharedFunctionInfo* shared_info, int height) { | 3477 BailoutId bailout_id, SharedFunctionInfo* shared_info, int height) { |
3211 TranslatedFrame frame(kConstructStub, shared_info->GetIsolate(), shared_info, | 3478 TranslatedFrame frame(kConstructStub, shared_info->GetIsolate(), shared_info, |
3212 height); | 3479 height); |
3213 frame.node_id_ = bailout_id; | 3480 frame.node_id_ = bailout_id; |
3214 return frame; | 3481 return frame; |
3215 } | 3482 } |
3216 | 3483 |
| 3484 TranslatedFrame TranslatedFrame::BuiltinContinuationFrame( |
| 3485 BailoutId bailout_id, SharedFunctionInfo* shared_info, int height) { |
| 3486 TranslatedFrame frame(kBuiltinContinuation, shared_info->GetIsolate(), |
| 3487 shared_info, height); |
| 3488 frame.node_id_ = bailout_id; |
| 3489 return frame; |
| 3490 } |
3217 | 3491 |
3218 int TranslatedFrame::GetValueCount() { | 3492 int TranslatedFrame::GetValueCount() { |
3219 switch (kind()) { | 3493 switch (kind()) { |
3220 case kFunction: { | 3494 case kFunction: { |
3221 int parameter_count = | 3495 int parameter_count = |
3222 raw_shared_info_->internal_formal_parameter_count() + 1; | 3496 raw_shared_info_->internal_formal_parameter_count() + 1; |
3223 // + 1 for function. | 3497 // + 1 for function. |
3224 return height_ + parameter_count + 1; | 3498 return height_ + parameter_count + 1; |
3225 } | 3499 } |
3226 | 3500 |
3227 case kInterpretedFunction: { | 3501 case kInterpretedFunction: { |
3228 int parameter_count = | 3502 int parameter_count = |
3229 raw_shared_info_->internal_formal_parameter_count() + 1; | 3503 raw_shared_info_->internal_formal_parameter_count() + 1; |
3230 // + 2 for function and context. | 3504 // + 2 for function and context. |
3231 return height_ + parameter_count + 2; | 3505 return height_ + parameter_count + 2; |
3232 } | 3506 } |
3233 | 3507 |
3234 case kGetter: | 3508 case kGetter: |
3235 return 2; // Function and receiver. | 3509 return 2; // Function and receiver. |
3236 | 3510 |
3237 case kSetter: | 3511 case kSetter: |
3238 return 3; // Function, receiver and the value to set. | 3512 return 3; // Function, receiver and the value to set. |
3239 | 3513 |
3240 case kArgumentsAdaptor: | 3514 case kArgumentsAdaptor: |
3241 case kConstructStub: | 3515 case kConstructStub: |
| 3516 case kBuiltinContinuation: |
3242 return 1 + height_; | 3517 return 1 + height_; |
3243 | 3518 |
3244 case kTailCallerFunction: | 3519 case kTailCallerFunction: |
3245 return 1; // Function. | 3520 return 1; // Function. |
3246 | 3521 |
3247 case kCompiledStub: | 3522 case kCompiledStub: |
3248 return height_; | 3523 return height_; |
3249 | 3524 |
3250 case kInvalid: | 3525 case kInvalid: |
3251 UNREACHABLE(); | 3526 UNREACHABLE(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3336 if (trace_file != nullptr) { | 3611 if (trace_file != nullptr) { |
3337 std::unique_ptr<char[]> name = shared_info->DebugName()->ToCString(); | 3612 std::unique_ptr<char[]> name = shared_info->DebugName()->ToCString(); |
3338 PrintF(trace_file, " reading construct stub frame %s", name.get()); | 3613 PrintF(trace_file, " reading construct stub frame %s", name.get()); |
3339 PrintF(trace_file, " => bailout_id=%d, height=%d; inputs:\n", | 3614 PrintF(trace_file, " => bailout_id=%d, height=%d; inputs:\n", |
3340 bailout_id.ToInt(), height); | 3615 bailout_id.ToInt(), height); |
3341 } | 3616 } |
3342 return TranslatedFrame::ConstructStubFrame(bailout_id, shared_info, | 3617 return TranslatedFrame::ConstructStubFrame(bailout_id, shared_info, |
3343 height); | 3618 height); |
3344 } | 3619 } |
3345 | 3620 |
| 3621 case Translation::BUILTIN_CONTINUATION_FRAME: { |
| 3622 BailoutId bailout_id = BailoutId(iterator->Next()); |
| 3623 SharedFunctionInfo* shared_info = |
| 3624 SharedFunctionInfo::cast(literal_array->get(iterator->Next())); |
| 3625 int height = iterator->Next(); |
| 3626 if (trace_file != nullptr) { |
| 3627 std::unique_ptr<char[]> name = shared_info->DebugName()->ToCString(); |
| 3628 PrintF(trace_file, " reading builtin continuation frame %s", |
| 3629 name.get()); |
| 3630 PrintF(trace_file, " => bailout_id=%d, height=%d; inputs:\n", |
| 3631 bailout_id.ToInt(), height); |
| 3632 } |
| 3633 return TranslatedFrame::BuiltinContinuationFrame(bailout_id, shared_info, |
| 3634 height); |
| 3635 } |
| 3636 |
3346 case Translation::GETTER_STUB_FRAME: { | 3637 case Translation::GETTER_STUB_FRAME: { |
3347 SharedFunctionInfo* shared_info = | 3638 SharedFunctionInfo* shared_info = |
3348 SharedFunctionInfo::cast(literal_array->get(iterator->Next())); | 3639 SharedFunctionInfo::cast(literal_array->get(iterator->Next())); |
3349 if (trace_file != nullptr) { | 3640 if (trace_file != nullptr) { |
3350 std::unique_ptr<char[]> name = shared_info->DebugName()->ToCString(); | 3641 std::unique_ptr<char[]> name = shared_info->DebugName()->ToCString(); |
3351 PrintF(trace_file, " reading getter frame %s; inputs:\n", name.get()); | 3642 PrintF(trace_file, " reading getter frame %s; inputs:\n", name.get()); |
3352 } | 3643 } |
3353 return TranslatedFrame::AccessorFrame(TranslatedFrame::kGetter, | 3644 return TranslatedFrame::AccessorFrame(TranslatedFrame::kGetter, |
3354 shared_info); | 3645 shared_info); |
3355 } | 3646 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3504 switch (opcode) { | 3795 switch (opcode) { |
3505 case Translation::BEGIN: | 3796 case Translation::BEGIN: |
3506 case Translation::JS_FRAME: | 3797 case Translation::JS_FRAME: |
3507 case Translation::INTERPRETED_FRAME: | 3798 case Translation::INTERPRETED_FRAME: |
3508 case Translation::ARGUMENTS_ADAPTOR_FRAME: | 3799 case Translation::ARGUMENTS_ADAPTOR_FRAME: |
3509 case Translation::TAIL_CALLER_FRAME: | 3800 case Translation::TAIL_CALLER_FRAME: |
3510 case Translation::CONSTRUCT_STUB_FRAME: | 3801 case Translation::CONSTRUCT_STUB_FRAME: |
3511 case Translation::GETTER_STUB_FRAME: | 3802 case Translation::GETTER_STUB_FRAME: |
3512 case Translation::SETTER_STUB_FRAME: | 3803 case Translation::SETTER_STUB_FRAME: |
3513 case Translation::COMPILED_STUB_FRAME: | 3804 case Translation::COMPILED_STUB_FRAME: |
| 3805 case Translation::BUILTIN_CONTINUATION_FRAME: |
3514 // Peeled off before getting here. | 3806 // Peeled off before getting here. |
3515 break; | 3807 break; |
3516 | 3808 |
3517 case Translation::DUPLICATED_OBJECT: { | 3809 case Translation::DUPLICATED_OBJECT: { |
3518 int object_id = iterator->Next(); | 3810 int object_id = iterator->Next(); |
3519 if (trace_file != nullptr) { | 3811 if (trace_file != nullptr) { |
3520 PrintF(trace_file, "duplicated object #%d", object_id); | 3812 PrintF(trace_file, "duplicated object #%d", object_id); |
3521 } | 3813 } |
3522 object_positions_.push_back(object_positions_[object_id]); | 3814 object_positions_.push_back(object_positions_[object_id]); |
3523 TranslatedValue translated_value = | 3815 TranslatedValue translated_value = |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4458 CHECK(value_info->IsMaterializedObject()); | 4750 CHECK(value_info->IsMaterializedObject()); |
4459 | 4751 |
4460 value_info->value_ = | 4752 value_info->value_ = |
4461 Handle<Object>(previously_materialized_objects->get(i), isolate_); | 4753 Handle<Object>(previously_materialized_objects->get(i), isolate_); |
4462 } | 4754 } |
4463 } | 4755 } |
4464 } | 4756 } |
4465 | 4757 |
4466 } // namespace internal | 4758 } // namespace internal |
4467 } // namespace v8 | 4759 } // namespace v8 |
OLD | NEW |