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 #include "v8conversions.h" | 9 #include "v8conversions.h" |
10 | 10 |
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 Handle<Code> code) { | 1323 Handle<Code> code) { |
1324 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, SLOPPY); | 1324 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, SLOPPY); |
1325 function->shared()->set_code(*code); | 1325 function->shared()->set_code(*code); |
1326 function->set_code(*code); | 1326 function->set_code(*code); |
1327 ASSERT(!function->has_initial_map()); | 1327 ASSERT(!function->has_initial_map()); |
1328 ASSERT(!function->has_prototype()); | 1328 ASSERT(!function->has_prototype()); |
1329 return function; | 1329 return function; |
1330 } | 1330 } |
1331 | 1331 |
1332 | 1332 |
1333 Handle<JSObject> Factory::NewIteratorResultObject(Handle<Object> value, | |
1334 bool done) { | |
1335 Handle<Map> map(isolate()->native_context()->iterator_result_map()); | |
1336 Handle<JSObject> result = NewJSObjectFromMap(map, NOT_TENURED, false); | |
1337 result->InObjectPropertyAtPut( | |
1338 JSGeneratorObject::kResultValuePropertyIndex, *value); | |
1339 result->InObjectPropertyAtPut( | |
1340 JSGeneratorObject::kResultDonePropertyIndex, *ToBoolean(done)); | |
1341 return result; | |
1342 } | |
1343 | |
1344 | |
1345 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { | 1333 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { |
1346 Handle<FixedArray> array = NewFixedArray(length, TENURED); | 1334 Handle<FixedArray> array = NewFixedArray(length, TENURED); |
1347 array->set_map_no_write_barrier(*scope_info_map()); | 1335 array->set_map_no_write_barrier(*scope_info_map()); |
1348 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); | 1336 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); |
1349 return scope_info; | 1337 return scope_info; |
1350 } | 1338 } |
1351 | 1339 |
1352 | 1340 |
1353 Handle<JSObject> Factory::NewExternal(void* value) { | 1341 Handle<JSObject> Factory::NewExternal(void* value) { |
1354 Handle<Foreign> foreign = NewForeign(static_cast<Address>(value)); | 1342 Handle<Foreign> foreign = NewForeign(static_cast<Address>(value)); |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 if (String::Equals(name, nan_string())) return nan_value(); | 2330 if (String::Equals(name, nan_string())) return nan_value(); |
2343 if (String::Equals(name, infinity_string())) return infinity_value(); | 2331 if (String::Equals(name, infinity_string())) return infinity_value(); |
2344 return Handle<Object>::null(); | 2332 return Handle<Object>::null(); |
2345 } | 2333 } |
2346 | 2334 |
2347 | 2335 |
2348 Handle<Object> Factory::ToBoolean(bool value) { | 2336 Handle<Object> Factory::ToBoolean(bool value) { |
2349 return value ? true_value() : false_value(); | 2337 return value ? true_value() : false_value(); |
2350 } | 2338 } |
2351 | 2339 |
2352 | |
2353 } } // namespace v8::internal | 2340 } } // namespace v8::internal |
OLD | NEW |