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 2465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2476 share->set_code(*code); | 2476 share->set_code(*code); |
2477 share->set_scope_info(ScopeInfo::Empty(isolate())); | 2477 share->set_scope_info(ScopeInfo::Empty(isolate())); |
2478 share->set_outer_scope_info(*the_hole_value()); | 2478 share->set_outer_scope_info(*the_hole_value()); |
2479 Handle<Code> construct_stub = | 2479 Handle<Code> construct_stub = |
2480 is_constructor ? isolate()->builtins()->JSConstructStubGeneric() | 2480 is_constructor ? isolate()->builtins()->JSConstructStubGeneric() |
2481 : isolate()->builtins()->ConstructedNonConstructable(); | 2481 : isolate()->builtins()->ConstructedNonConstructable(); |
2482 share->SetConstructStub(*construct_stub); | 2482 share->SetConstructStub(*construct_stub); |
2483 share->set_instance_class_name(*Object_string()); | 2483 share->set_instance_class_name(*Object_string()); |
2484 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); | 2484 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); |
2485 share->set_debug_info(Smi::kZero, SKIP_WRITE_BARRIER); | 2485 share->set_debug_info(Smi::kZero, SKIP_WRITE_BARRIER); |
| 2486 share->set_coverage_info(Smi::kZero, SKIP_WRITE_BARRIER); |
2486 share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER); | 2487 share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER); |
2487 StaticFeedbackVectorSpec empty_spec; | 2488 StaticFeedbackVectorSpec empty_spec; |
2488 Handle<FeedbackMetadata> feedback_metadata = | 2489 Handle<FeedbackMetadata> feedback_metadata = |
2489 FeedbackMetadata::New(isolate(), &empty_spec); | 2490 FeedbackMetadata::New(isolate(), &empty_spec); |
2490 share->set_feedback_metadata(*feedback_metadata, SKIP_WRITE_BARRIER); | 2491 share->set_feedback_metadata(*feedback_metadata, SKIP_WRITE_BARRIER); |
2491 share->set_function_literal_id(FunctionLiteral::kIdTypeInvalid); | 2492 share->set_function_literal_id(FunctionLiteral::kIdTypeInvalid); |
2492 #if TRACE_MAPS | 2493 #if TRACE_MAPS |
2493 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); | 2494 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); |
2494 #endif | 2495 #endif |
2495 share->set_profiler_ticks(0); | 2496 share->set_profiler_ticks(0); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2608 debug_info->set_debugger_hints(shared->debugger_hints()); | 2609 debug_info->set_debugger_hints(shared->debugger_hints()); |
2609 debug_info->set_debug_bytecode_array(*maybe_debug_bytecode_array); | 2610 debug_info->set_debug_bytecode_array(*maybe_debug_bytecode_array); |
2610 debug_info->set_break_points(*break_points); | 2611 debug_info->set_break_points(*break_points); |
2611 | 2612 |
2612 // Link debug info to function. | 2613 // Link debug info to function. |
2613 shared->set_debug_info(*debug_info); | 2614 shared->set_debug_info(*debug_info); |
2614 | 2615 |
2615 return debug_info; | 2616 return debug_info; |
2616 } | 2617 } |
2617 | 2618 |
| 2619 Handle<CoverageInfo> Factory::NewCoverageInfo( |
| 2620 const ZoneVector<SourceRange>& slots) { |
| 2621 const int slot_count = static_cast<int>(slots.size()); |
| 2622 |
| 2623 const int length = CoverageInfo::FixedArrayLengthForSlotCount(slot_count); |
| 2624 Handle<CoverageInfo> info = |
| 2625 Handle<CoverageInfo>::cast(NewUninitializedFixedArray(length)); |
| 2626 |
| 2627 for (int i = 0; i < slot_count; i++) { |
| 2628 SourceRange range = slots[i]; |
| 2629 info->InitializeSlot(i, range.from, range.to); |
| 2630 } |
| 2631 |
| 2632 return info; |
| 2633 } |
| 2634 |
2618 Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) { | 2635 Handle<BreakPointInfo> Factory::NewBreakPointInfo(int source_position) { |
2619 Handle<BreakPointInfo> new_break_point_info = | 2636 Handle<BreakPointInfo> new_break_point_info = |
2620 Handle<BreakPointInfo>::cast(NewStruct(TUPLE2_TYPE)); | 2637 Handle<BreakPointInfo>::cast(NewStruct(TUPLE2_TYPE)); |
2621 new_break_point_info->set_source_position(source_position); | 2638 new_break_point_info->set_source_position(source_position); |
2622 new_break_point_info->set_break_point_objects(*undefined_value()); | 2639 new_break_point_info->set_break_point_objects(*undefined_value()); |
2623 return new_break_point_info; | 2640 return new_break_point_info; |
2624 } | 2641 } |
2625 | 2642 |
2626 Handle<StackFrameInfo> Factory::NewStackFrameInfo() { | 2643 Handle<StackFrameInfo> Factory::NewStackFrameInfo() { |
2627 Handle<StackFrameInfo> stack_frame_info = | 2644 Handle<StackFrameInfo> stack_frame_info = |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2952 Handle<AccessorInfo> prototype = | 2969 Handle<AccessorInfo> prototype = |
2953 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); | 2970 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); |
2954 Descriptor d = Descriptor::AccessorConstant( | 2971 Descriptor d = Descriptor::AccessorConstant( |
2955 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); | 2972 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); |
2956 map->AppendDescriptor(&d); | 2973 map->AppendDescriptor(&d); |
2957 } | 2974 } |
2958 } | 2975 } |
2959 | 2976 |
2960 } // namespace internal | 2977 } // namespace internal |
2961 } // namespace v8 | 2978 } // namespace v8 |
OLD | NEW |