| 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 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 Handle<Code> code) { | 1251 Handle<Code> code) { |
| 1252 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, SLOPPY); | 1252 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, SLOPPY); |
| 1253 function->shared()->set_code(*code); | 1253 function->shared()->set_code(*code); |
| 1254 function->set_code(*code); | 1254 function->set_code(*code); |
| 1255 ASSERT(!function->has_initial_map()); | 1255 ASSERT(!function->has_initial_map()); |
| 1256 ASSERT(!function->has_prototype()); | 1256 ASSERT(!function->has_prototype()); |
| 1257 return function; | 1257 return function; |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 | 1260 |
| 1261 Handle<JSObject> Factory::NewIteratorResultObject(Handle<Object> value, | |
| 1262 bool done) { | |
| 1263 Handle<Map> map(isolate()->native_context()->iterator_result_map()); | |
| 1264 Handle<JSObject> result = NewJSObjectFromMap(map, NOT_TENURED, false); | |
| 1265 result->InObjectPropertyAtPut( | |
| 1266 JSGeneratorObject::kResultValuePropertyIndex, *value); | |
| 1267 result->InObjectPropertyAtPut( | |
| 1268 JSGeneratorObject::kResultDonePropertyIndex, *ToBoolean(done)); | |
| 1269 return result; | |
| 1270 } | |
| 1271 | |
| 1272 | |
| 1273 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { | 1261 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { |
| 1274 Handle<FixedArray> array = NewFixedArray(length, TENURED); | 1262 Handle<FixedArray> array = NewFixedArray(length, TENURED); |
| 1275 array->set_map_no_write_barrier(*scope_info_map()); | 1263 array->set_map_no_write_barrier(*scope_info_map()); |
| 1276 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); | 1264 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); |
| 1277 return scope_info; | 1265 return scope_info; |
| 1278 } | 1266 } |
| 1279 | 1267 |
| 1280 | 1268 |
| 1281 Handle<JSObject> Factory::NewExternal(void* value) { | 1269 Handle<JSObject> Factory::NewExternal(void* value) { |
| 1282 Handle<Foreign> foreign = NewForeign(static_cast<Address>(value)); | 1270 Handle<Foreign> foreign = NewForeign(static_cast<Address>(value)); |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2108 if (String::Equals(name, nan_string())) return nan_value(); | 2096 if (String::Equals(name, nan_string())) return nan_value(); |
| 2109 if (String::Equals(name, infinity_string())) return infinity_value(); | 2097 if (String::Equals(name, infinity_string())) return infinity_value(); |
| 2110 return Handle<Object>::null(); | 2098 return Handle<Object>::null(); |
| 2111 } | 2099 } |
| 2112 | 2100 |
| 2113 | 2101 |
| 2114 Handle<Object> Factory::ToBoolean(bool value) { | 2102 Handle<Object> Factory::ToBoolean(bool value) { |
| 2115 return value ? true_value() : false_value(); | 2103 return value ? true_value() : false_value(); |
| 2116 } | 2104 } |
| 2117 | 2105 |
| 2118 | |
| 2119 } } // namespace v8::internal | 2106 } } // namespace v8::internal |
| OLD | NEW |