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 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 Handle<Code> code) { | 1290 Handle<Code> code) { |
1291 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, SLOPPY); | 1291 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, SLOPPY); |
1292 function->shared()->set_code(*code); | 1292 function->shared()->set_code(*code); |
1293 function->set_code(*code); | 1293 function->set_code(*code); |
1294 ASSERT(!function->has_initial_map()); | 1294 ASSERT(!function->has_initial_map()); |
1295 ASSERT(!function->has_prototype()); | 1295 ASSERT(!function->has_prototype()); |
1296 return function; | 1296 return function; |
1297 } | 1297 } |
1298 | 1298 |
1299 | 1299 |
| 1300 Handle<JSObject> Factory::NewIteratorResultObject(Handle<Object> value, |
| 1301 bool done) { |
| 1302 Handle<Map> map(isolate()->native_context()->iterator_result_map()); |
| 1303 Handle<JSObject> result = NewJSObjectFromMap(map, NOT_TENURED, false); |
| 1304 result->InObjectPropertyAtPut( |
| 1305 JSGeneratorObject::kResultValuePropertyIndex, *value); |
| 1306 result->InObjectPropertyAtPut( |
| 1307 JSGeneratorObject::kResultDonePropertyIndex, *ToBoolean(done)); |
| 1308 return result; |
| 1309 } |
| 1310 |
| 1311 |
1300 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { | 1312 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { |
1301 Handle<FixedArray> array = NewFixedArray(length, TENURED); | 1313 Handle<FixedArray> array = NewFixedArray(length, TENURED); |
1302 array->set_map_no_write_barrier(*scope_info_map()); | 1314 array->set_map_no_write_barrier(*scope_info_map()); |
1303 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); | 1315 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); |
1304 return scope_info; | 1316 return scope_info; |
1305 } | 1317 } |
1306 | 1318 |
1307 | 1319 |
1308 Handle<JSObject> Factory::NewExternal(void* value) { | 1320 Handle<JSObject> Factory::NewExternal(void* value) { |
1309 Handle<Foreign> foreign = NewForeign(static_cast<Address>(value)); | 1321 Handle<Foreign> foreign = NewForeign(static_cast<Address>(value)); |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2248 if (String::Equals(name, nan_string())) return nan_value(); | 2260 if (String::Equals(name, nan_string())) return nan_value(); |
2249 if (String::Equals(name, infinity_string())) return infinity_value(); | 2261 if (String::Equals(name, infinity_string())) return infinity_value(); |
2250 return Handle<Object>::null(); | 2262 return Handle<Object>::null(); |
2251 } | 2263 } |
2252 | 2264 |
2253 | 2265 |
2254 Handle<Object> Factory::ToBoolean(bool value) { | 2266 Handle<Object> Factory::ToBoolean(bool value) { |
2255 return value ? true_value() : false_value(); | 2267 return value ? true_value() : false_value(); |
2256 } | 2268 } |
2257 | 2269 |
| 2270 |
2258 } } // namespace v8::internal | 2271 } } // namespace v8::internal |
OLD | NEW |