OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/factory.h" | 5 #include "src/factory.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2398 share->set_code(*code); | 2398 share->set_code(*code); |
2399 share->set_optimized_code_map(*empty_fixed_array()); | 2399 share->set_optimized_code_map(*empty_fixed_array()); |
2400 share->set_scope_info(ScopeInfo::Empty(isolate())); | 2400 share->set_scope_info(ScopeInfo::Empty(isolate())); |
2401 share->set_outer_scope_info(*the_hole_value()); | 2401 share->set_outer_scope_info(*the_hole_value()); |
2402 Handle<Code> construct_stub = | 2402 Handle<Code> construct_stub = |
2403 is_constructor ? isolate()->builtins()->JSConstructStubGeneric() | 2403 is_constructor ? isolate()->builtins()->JSConstructStubGeneric() |
2404 : isolate()->builtins()->ConstructedNonConstructable(); | 2404 : isolate()->builtins()->ConstructedNonConstructable(); |
2405 share->SetConstructStub(*construct_stub); | 2405 share->SetConstructStub(*construct_stub); |
2406 share->set_instance_class_name(*Object_string()); | 2406 share->set_instance_class_name(*Object_string()); |
2407 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); | 2407 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); |
2408 share->set_debug_info(DebugInfo::uninitialized(), SKIP_WRITE_BARRIER); | 2408 share->set_debug_info(Smi::kZero, SKIP_WRITE_BARRIER); |
2409 share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER); | 2409 share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER); |
2410 StaticFeedbackVectorSpec empty_spec; | 2410 StaticFeedbackVectorSpec empty_spec; |
2411 Handle<TypeFeedbackMetadata> feedback_metadata = | 2411 Handle<TypeFeedbackMetadata> feedback_metadata = |
2412 TypeFeedbackMetadata::New(isolate(), &empty_spec); | 2412 TypeFeedbackMetadata::New(isolate(), &empty_spec); |
2413 share->set_feedback_metadata(*feedback_metadata, SKIP_WRITE_BARRIER); | 2413 share->set_feedback_metadata(*feedback_metadata, SKIP_WRITE_BARRIER); |
2414 share->set_function_literal_id(FunctionLiteral::kIdTypeInvalid); | 2414 share->set_function_literal_id(FunctionLiteral::kIdTypeInvalid); |
2415 #if TRACE_MAPS | 2415 #if TRACE_MAPS |
2416 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); | 2416 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); |
2417 #endif | 2417 #endif |
2418 share->set_profiler_ticks(0); | 2418 share->set_profiler_ticks(0); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2502 | 2502 |
2503 // We tenure the allocated string since it is referenced from the | 2503 // We tenure the allocated string since it is referenced from the |
2504 // number-string cache which lives in the old space. | 2504 // number-string cache which lives in the old space. |
2505 Handle<String> js_string = NewStringFromAsciiChecked(str, TENURED); | 2505 Handle<String> js_string = NewStringFromAsciiChecked(str, TENURED); |
2506 SetNumberStringCache(number, js_string); | 2506 SetNumberStringCache(number, js_string); |
2507 return js_string; | 2507 return js_string; |
2508 } | 2508 } |
2509 | 2509 |
2510 | 2510 |
2511 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { | 2511 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { |
| 2512 DCHECK(!shared->HasDebugInfo()); |
2512 // Allocate initial fixed array for active break points before allocating the | 2513 // Allocate initial fixed array for active break points before allocating the |
2513 // debug info object to avoid allocation while setting up the debug info | 2514 // debug info object to avoid allocation while setting up the debug info |
2514 // object. | 2515 // object. |
2515 Handle<FixedArray> break_points( | 2516 Handle<FixedArray> break_points( |
2516 NewFixedArray(DebugInfo::kEstimatedNofBreakPointsInFunction)); | 2517 NewFixedArray(DebugInfo::kEstimatedNofBreakPointsInFunction)); |
2517 | 2518 |
2518 // Make a copy of the bytecode array if available. | 2519 // Make a copy of the bytecode array if available. |
2519 Handle<Object> maybe_debug_bytecode_array = undefined_value(); | 2520 Handle<Object> maybe_debug_bytecode_array = undefined_value(); |
2520 if (shared->HasBytecodeArray()) { | 2521 if (shared->HasBytecodeArray()) { |
2521 Handle<BytecodeArray> original(shared->bytecode_array()); | 2522 Handle<BytecodeArray> original(shared->bytecode_array()); |
2522 maybe_debug_bytecode_array = CopyBytecodeArray(original); | 2523 maybe_debug_bytecode_array = CopyBytecodeArray(original); |
2523 } | 2524 } |
2524 | 2525 |
2525 // Create and set up the debug info object. Debug info contains function, a | 2526 // Create and set up the debug info object. Debug info contains function, a |
2526 // copy of the original code, the executing code and initial fixed array for | 2527 // copy of the original code, the executing code and initial fixed array for |
2527 // active break points. | 2528 // active break points. |
2528 Handle<DebugInfo> debug_info = | 2529 Handle<DebugInfo> debug_info = |
2529 Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE)); | 2530 Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE)); |
2530 debug_info->set_shared(*shared); | 2531 debug_info->set_shared(*shared); |
| 2532 debug_info->set_debugger_hints(shared->debugger_hints()); |
2531 debug_info->set_debug_bytecode_array(*maybe_debug_bytecode_array); | 2533 debug_info->set_debug_bytecode_array(*maybe_debug_bytecode_array); |
2532 debug_info->set_break_points(*break_points); | 2534 debug_info->set_break_points(*break_points); |
2533 | 2535 |
2534 // Link debug info to function. | 2536 // Link debug info to function. |
2535 shared->set_debug_info(*debug_info); | 2537 shared->set_debug_info(*debug_info); |
2536 | 2538 |
2537 return debug_info; | 2539 return debug_info; |
2538 } | 2540 } |
2539 | 2541 |
2540 Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) { | 2542 Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) { |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2844 Handle<AccessorInfo> prototype = | 2846 Handle<AccessorInfo> prototype = |
2845 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); | 2847 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); |
2846 Descriptor d = Descriptor::AccessorConstant( | 2848 Descriptor d = Descriptor::AccessorConstant( |
2847 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); | 2849 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); |
2848 map->AppendDescriptor(&d); | 2850 map->AppendDescriptor(&d); |
2849 } | 2851 } |
2850 } | 2852 } |
2851 | 2853 |
2852 } // namespace internal | 2854 } // namespace internal |
2853 } // namespace v8 | 2855 } // namespace v8 |
OLD | NEW |