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 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2262 shared->set_scope_info(*scope_info); | 2262 shared->set_scope_info(*scope_info); |
2263 shared->set_outer_scope_info(*the_hole_value()); | 2263 shared->set_outer_scope_info(*the_hole_value()); |
2264 shared->set_kind(kind); | 2264 shared->set_kind(kind); |
2265 shared->set_num_literals(number_of_literals); | 2265 shared->set_num_literals(number_of_literals); |
2266 if (IsGeneratorFunction(kind)) { | 2266 if (IsGeneratorFunction(kind)) { |
2267 shared->set_instance_class_name(isolate()->heap()->Generator_string()); | 2267 shared->set_instance_class_name(isolate()->heap()->Generator_string()); |
2268 } | 2268 } |
2269 return shared; | 2269 return shared; |
2270 } | 2270 } |
2271 | 2271 |
| 2272 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfoForLiteral( |
| 2273 FunctionLiteral* literal, Handle<Script> script) { |
| 2274 Handle<Code> code = isolate()->builtins()->CompileLazy(); |
| 2275 Handle<ScopeInfo> scope_info = handle(ScopeInfo::Empty(isolate())); |
| 2276 Handle<SharedFunctionInfo> result = NewSharedFunctionInfo( |
| 2277 literal->name(), literal->materialized_literal_count(), literal->kind(), |
| 2278 code, scope_info); |
| 2279 SharedFunctionInfo::InitFromFunctionLiteral(result, literal); |
| 2280 SharedFunctionInfo::SetScript(result, script); |
| 2281 return result; |
| 2282 } |
2272 | 2283 |
2273 Handle<JSMessageObject> Factory::NewJSMessageObject( | 2284 Handle<JSMessageObject> Factory::NewJSMessageObject( |
2274 MessageTemplate::Template message, Handle<Object> argument, | 2285 MessageTemplate::Template message, Handle<Object> argument, |
2275 int start_position, int end_position, Handle<Object> script, | 2286 int start_position, int end_position, Handle<Object> script, |
2276 Handle<Object> stack_frames) { | 2287 Handle<Object> stack_frames) { |
2277 Handle<Map> map = message_object_map(); | 2288 Handle<Map> map = message_object_map(); |
2278 Handle<JSMessageObject> message_obj = New<JSMessageObject>(map, NEW_SPACE); | 2289 Handle<JSMessageObject> message_obj = New<JSMessageObject>(map, NEW_SPACE); |
2279 message_obj->set_properties(*empty_fixed_array(), SKIP_WRITE_BARRIER); | 2290 message_obj->set_properties(*empty_fixed_array(), SKIP_WRITE_BARRIER); |
2280 message_obj->initialize_elements(); | 2291 message_obj->initialize_elements(); |
2281 message_obj->set_elements(*empty_fixed_array(), SKIP_WRITE_BARRIER); | 2292 message_obj->set_elements(*empty_fixed_array(), SKIP_WRITE_BARRIER); |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2732 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); | 2743 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); |
2733 iterator->set_initial_next(*next); | 2744 iterator->set_initial_next(*next); |
2734 iterator->set_array(*array); | 2745 iterator->set_array(*array); |
2735 iterator->set_index(0); | 2746 iterator->set_index(0); |
2736 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); | 2747 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); |
2737 return iterator; | 2748 return iterator; |
2738 } | 2749 } |
2739 | 2750 |
2740 } // namespace internal | 2751 } // namespace internal |
2741 } // namespace v8 | 2752 } // namespace v8 |
OLD | NEW |