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 "macro-assembler.h" | 7 #include "macro-assembler.h" |
8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 | 33 |
34 Handle<Box> Factory::NewBox(Handle<Object> value) { | 34 Handle<Box> Factory::NewBox(Handle<Object> value) { |
35 Handle<Box> result = Handle<Box>::cast(NewStruct(BOX_TYPE)); | 35 Handle<Box> result = Handle<Box>::cast(NewStruct(BOX_TYPE)); |
36 result->set_value(*value); | 36 result->set_value(*value); |
37 return result; | 37 return result; |
38 } | 38 } |
39 | 39 |
40 | 40 |
| 41 Handle<Oddball> Factory::NewOddball(Handle<Map> map, |
| 42 const char* to_string, |
| 43 Handle<Object> to_number, |
| 44 byte kind) { |
| 45 Handle<Oddball> oddball = New<Oddball>(map, OLD_POINTER_SPACE); |
| 46 Oddball::Initialize(isolate(), oddball, to_string, to_number, kind); |
| 47 return oddball; |
| 48 } |
| 49 |
| 50 |
41 Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) { | 51 Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) { |
42 ASSERT(0 <= size); | 52 ASSERT(0 <= size); |
43 CALL_HEAP_FUNCTION( | 53 CALL_HEAP_FUNCTION( |
44 isolate(), | 54 isolate(), |
45 isolate()->heap()->AllocateFixedArray(size, pretenure), | 55 isolate()->heap()->AllocateFixedArray(size, pretenure), |
46 FixedArray); | 56 FixedArray); |
47 } | 57 } |
48 | 58 |
49 | 59 |
50 Handle<FixedArray> Factory::NewFixedArrayWithHoles(int size, | 60 Handle<FixedArray> Factory::NewFixedArrayWithHoles(int size, |
(...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 if (String::Equals(name, infinity_string())) return infinity_value(); | 2180 if (String::Equals(name, infinity_string())) return infinity_value(); |
2171 return Handle<Object>::null(); | 2181 return Handle<Object>::null(); |
2172 } | 2182 } |
2173 | 2183 |
2174 | 2184 |
2175 Handle<Object> Factory::ToBoolean(bool value) { | 2185 Handle<Object> Factory::ToBoolean(bool value) { |
2176 return value ? true_value() : false_value(); | 2186 return value ? true_value() : false_value(); |
2177 } | 2187 } |
2178 | 2188 |
2179 } } // namespace v8::internal | 2189 } } // namespace v8::internal |
OLD | NEW |