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 |
40 Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) { | 50 Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) { |
41 ASSERT(0 <= size); | 51 ASSERT(0 <= size); |
42 CALL_HEAP_FUNCTION( | 52 CALL_HEAP_FUNCTION( |
43 isolate(), | 53 isolate(), |
44 isolate()->heap()->AllocateFixedArray(size, pretenure), | 54 isolate()->heap()->AllocateFixedArray(size, pretenure), |
45 FixedArray); | 55 FixedArray); |
46 } | 56 } |
47 | 57 |
48 | 58 |
49 Handle<FixedArray> Factory::NewFixedArrayWithHoles(int size, | 59 Handle<FixedArray> Factory::NewFixedArrayWithHoles(int size, |
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 if (String::Equals(name, infinity_string())) return infinity_value(); | 2107 if (String::Equals(name, infinity_string())) return infinity_value(); |
2098 return Handle<Object>::null(); | 2108 return Handle<Object>::null(); |
2099 } | 2109 } |
2100 | 2110 |
2101 | 2111 |
2102 Handle<Object> Factory::ToBoolean(bool value) { | 2112 Handle<Object> Factory::ToBoolean(bool value) { |
2103 return value ? true_value() : false_value(); | 2113 return value ? true_value() : false_value(); |
2104 } | 2114 } |
2105 | 2115 |
2106 } } // namespace v8::internal | 2116 } } // namespace v8::internal |
OLD | NEW |