| 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 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2585 // We tenure the allocated string since it is referenced from the | 2585 // We tenure the allocated string since it is referenced from the |
| 2586 // number-string cache which lives in the old space. | 2586 // number-string cache which lives in the old space. |
| 2587 Handle<String> js_string = NewStringFromAsciiChecked(str, TENURED); | 2587 Handle<String> js_string = NewStringFromAsciiChecked(str, TENURED); |
| 2588 SetNumberStringCache(number, js_string); | 2588 SetNumberStringCache(number, js_string); |
| 2589 return js_string; | 2589 return js_string; |
| 2590 } | 2590 } |
| 2591 | 2591 |
| 2592 | 2592 |
| 2593 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { | 2593 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { |
| 2594 DCHECK(!shared->HasDebugInfo()); | 2594 DCHECK(!shared->HasDebugInfo()); |
| 2595 // Allocate initial fixed array for active break points before allocating the | 2595 Heap* heap = isolate()->heap(); |
| 2596 // debug info object to avoid allocation while setting up the debug info | |
| 2597 // object. | |
| 2598 Handle<FixedArray> break_points( | |
| 2599 NewFixedArray(DebugInfo::kEstimatedNofBreakPointsInFunction)); | |
| 2600 | 2596 |
| 2601 // Make a copy of the bytecode array if available. | |
| 2602 Handle<Object> maybe_debug_bytecode_array = undefined_value(); | |
| 2603 if (shared->HasBytecodeArray()) { | |
| 2604 Handle<BytecodeArray> original(shared->bytecode_array()); | |
| 2605 maybe_debug_bytecode_array = CopyBytecodeArray(original); | |
| 2606 } | |
| 2607 | |
| 2608 // Create and set up the debug info object. Debug info contains function, a | |
| 2609 // copy of the original code, the executing code and initial fixed array for | |
| 2610 // active break points. | |
| 2611 Handle<DebugInfo> debug_info = | 2597 Handle<DebugInfo> debug_info = |
| 2612 Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE)); | 2598 Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE)); |
| 2599 debug_info->set_flags(DebugInfo::kNone); |
| 2613 debug_info->set_shared(*shared); | 2600 debug_info->set_shared(*shared); |
| 2614 debug_info->set_debugger_hints(shared->debugger_hints()); | 2601 debug_info->set_debugger_hints(shared->debugger_hints()); |
| 2615 debug_info->set_debug_bytecode_array(*maybe_debug_bytecode_array); | 2602 debug_info->set_debug_bytecode_array(heap->undefined_value()); |
| 2616 debug_info->set_break_points(*break_points); | 2603 debug_info->set_break_points(heap->empty_fixed_array()); |
| 2617 | 2604 |
| 2618 // Link debug info to function. | 2605 // Link debug info to function. |
| 2619 shared->set_debug_info(*debug_info); | 2606 shared->set_debug_info(*debug_info); |
| 2620 | 2607 |
| 2621 return debug_info; | 2608 return debug_info; |
| 2622 } | 2609 } |
| 2623 | 2610 |
| 2624 Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) { | 2611 Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) { |
| 2625 Handle<BreakPointInfo> new_break_point_info = | 2612 Handle<BreakPointInfo> new_break_point_info = |
| 2626 Handle<BreakPointInfo>::cast(NewStruct(TUPLE2_TYPE)); | 2613 Handle<BreakPointInfo>::cast(NewStruct(TUPLE2_TYPE)); |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2957 Handle<AccessorInfo> prototype = | 2944 Handle<AccessorInfo> prototype = |
| 2958 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); | 2945 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); |
| 2959 Descriptor d = Descriptor::AccessorConstant( | 2946 Descriptor d = Descriptor::AccessorConstant( |
| 2960 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); | 2947 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); |
| 2961 map->AppendDescriptor(&d); | 2948 map->AppendDescriptor(&d); |
| 2962 } | 2949 } |
| 2963 } | 2950 } |
| 2964 | 2951 |
| 2965 } // namespace internal | 2952 } // namespace internal |
| 2966 } // namespace v8 | 2953 } // namespace v8 |
| OLD | NEW |