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/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 } | 844 } |
845 | 845 |
846 | 846 |
847 Handle<Script> Factory::NewScript(Handle<String> source) { | 847 Handle<Script> Factory::NewScript(Handle<String> source) { |
848 // Create and initialize script object. | 848 // Create and initialize script object. |
849 Heap* heap = isolate()->heap(); | 849 Heap* heap = isolate()->heap(); |
850 Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE)); | 850 Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE)); |
851 script->set_source(*source); | 851 script->set_source(*source); |
852 script->set_name(heap->undefined_value()); | 852 script->set_name(heap->undefined_value()); |
853 script->set_id(isolate()->heap()->NextScriptId()); | 853 script->set_id(isolate()->heap()->NextScriptId()); |
854 script->set_line_offset(Smi::FromInt(0)); | 854 script->set_line_offset(0); |
855 script->set_column_offset(Smi::FromInt(0)); | 855 script->set_column_offset(0); |
856 script->set_context_data(heap->undefined_value()); | 856 script->set_context_data(heap->undefined_value()); |
857 script->set_type(Smi::FromInt(Script::TYPE_NORMAL)); | 857 script->set_type(Script::TYPE_NORMAL); |
858 script->set_wrapper(heap->undefined_value()); | 858 script->set_wrapper(heap->undefined_value()); |
859 script->set_line_ends(heap->undefined_value()); | 859 script->set_line_ends(heap->undefined_value()); |
860 script->set_eval_from_shared(heap->undefined_value()); | 860 script->set_eval_from_shared(heap->undefined_value()); |
861 script->set_eval_from_instructions_offset(Smi::FromInt(0)); | 861 script->set_eval_from_instructions_offset(0); |
862 script->set_shared_function_infos(Smi::FromInt(0)); | 862 script->set_shared_function_infos(Smi::FromInt(0)); |
863 script->set_flags(Smi::FromInt(0)); | 863 script->set_flags(0); |
864 | 864 |
865 heap->set_script_list(*WeakFixedArray::Add(script_list(), script)); | 865 heap->set_script_list(*WeakFixedArray::Add(script_list(), script)); |
866 return script; | 866 return script; |
867 } | 867 } |
868 | 868 |
869 | 869 |
870 Handle<Foreign> Factory::NewForeign(Address addr, PretenureFlag pretenure) { | 870 Handle<Foreign> Factory::NewForeign(Address addr, PretenureFlag pretenure) { |
871 CALL_HEAP_FUNCTION(isolate(), | 871 CALL_HEAP_FUNCTION(isolate(), |
872 isolate()->heap()->AllocateForeign(addr, pretenure), | 872 isolate()->heap()->AllocateForeign(addr, pretenure), |
873 Foreign); | 873 Foreign); |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 } | 2374 } |
2375 | 2375 |
2376 | 2376 |
2377 Handle<Object> Factory::ToBoolean(bool value) { | 2377 Handle<Object> Factory::ToBoolean(bool value) { |
2378 return value ? true_value() : false_value(); | 2378 return value ? true_value() : false_value(); |
2379 } | 2379 } |
2380 | 2380 |
2381 | 2381 |
2382 } // namespace internal | 2382 } // namespace internal |
2383 } // namespace v8 | 2383 } // namespace v8 |
OLD | NEW |