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 "factory.h" | 5 #include "factory.h" |
6 | 6 |
7 #include "isolate-inl.h" | 7 #include "isolate-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 | 32 |
33 Handle<Box> Factory::NewBox(Handle<Object> value) { | 33 Handle<Box> Factory::NewBox(Handle<Object> value) { |
34 Handle<Box> result = Handle<Box>::cast(NewStruct(BOX_TYPE)); | 34 Handle<Box> result = Handle<Box>::cast(NewStruct(BOX_TYPE)); |
35 result->set_value(*value); | 35 result->set_value(*value); |
36 return result; | 36 return result; |
37 } | 37 } |
38 | 38 |
39 | 39 |
40 Handle<Oddball> Factory::NewOddball(Handle<Map> map, | |
41 const char* to_string, | |
42 Handle<Object> to_number, | |
43 byte kind) { | |
44 Handle<Oddball> oddball = New<Oddball>(map, OLD_POINTER_SPACE); | |
45 Oddball::Initialize(isolate(), oddball, to_string, to_number, kind); | |
46 return oddball; | |
47 } | |
48 | |
49 | |
50 Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) { | 40 Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) { |
51 ASSERT(0 <= size); | 41 ASSERT(0 <= size); |
52 CALL_HEAP_FUNCTION( | 42 CALL_HEAP_FUNCTION( |
53 isolate(), | 43 isolate(), |
54 isolate()->heap()->AllocateFixedArray(size, pretenure), | 44 isolate()->heap()->AllocateFixedArray(size, pretenure), |
55 FixedArray); | 45 FixedArray); |
56 } | 46 } |
57 | 47 |
58 | 48 |
59 Handle<FixedArray> Factory::NewFixedArrayWithHoles(int size, | 49 Handle<FixedArray> Factory::NewFixedArrayWithHoles(int size, |
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 if (String::Equals(name, infinity_string())) return infinity_value(); | 2097 if (String::Equals(name, infinity_string())) return infinity_value(); |
2108 return Handle<Object>::null(); | 2098 return Handle<Object>::null(); |
2109 } | 2099 } |
2110 | 2100 |
2111 | 2101 |
2112 Handle<Object> Factory::ToBoolean(bool value) { | 2102 Handle<Object> Factory::ToBoolean(bool value) { |
2113 return value ? true_value() : false_value(); | 2103 return value ? true_value() : false_value(); |
2114 } | 2104 } |
2115 | 2105 |
2116 } } // namespace v8::internal | 2106 } } // namespace v8::internal |
OLD | NEW |