| 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 "src/factory.h" | 5 #include "src/factory.h" |
| 6 | 6 |
| 7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/code-stubs.h" |
| 9 #include "src/conversions.h" | 10 #include "src/conversions.h" |
| 10 #include "src/isolate-inl.h" | 11 #include "src/isolate-inl.h" |
| 11 #include "src/macro-assembler.h" | 12 #include "src/macro-assembler.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 | 17 |
| 17 template<typename T> | 18 template<typename T> |
| 18 Handle<T> Factory::New(Handle<Map> map, AllocationSpace space) { | 19 Handle<T> Factory::New(Handle<Map> map, AllocationSpace space) { |
| (...skipping 2214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2233 Object::SetProperty(result, callee_string(), callee, STRICT).Assert(); | 2234 Object::SetProperty(result, callee_string(), callee, STRICT).Assert(); |
| 2234 } | 2235 } |
| 2235 return result; | 2236 return result; |
| 2236 } | 2237 } |
| 2237 | 2238 |
| 2238 | 2239 |
| 2239 Handle<JSFunction> Factory::CreateApiFunction( | 2240 Handle<JSFunction> Factory::CreateApiFunction( |
| 2240 Handle<FunctionTemplateInfo> obj, | 2241 Handle<FunctionTemplateInfo> obj, |
| 2241 Handle<Object> prototype, | 2242 Handle<Object> prototype, |
| 2242 ApiInstanceType instance_type) { | 2243 ApiInstanceType instance_type) { |
| 2243 Handle<Code> code = isolate()->builtins()->HandleApiCall(); | 2244 Handle<Code> code; |
| 2245 { |
| 2246 JSApiFunctionStub stub(isolate(), obj); |
| 2247 code = stub.GetCode(); |
| 2248 } |
| 2244 Handle<Code> construct_stub = isolate()->builtins()->JSConstructStubApi(); | 2249 Handle<Code> construct_stub = isolate()->builtins()->JSConstructStubApi(); |
| 2245 | 2250 |
| 2246 Handle<JSFunction> result; | 2251 Handle<JSFunction> result; |
| 2247 if (obj->remove_prototype()) { | 2252 if (obj->remove_prototype()) { |
| 2248 result = NewFunctionWithoutPrototype(empty_string(), code); | 2253 result = NewFunctionWithoutPrototype(empty_string(), code); |
| 2249 } else { | 2254 } else { |
| 2250 int internal_field_count = 0; | 2255 int internal_field_count = 0; |
| 2251 if (!obj->instance_template()->IsUndefined()) { | 2256 if (!obj->instance_template()->IsUndefined()) { |
| 2252 Handle<ObjectTemplateInfo> instance_template = | 2257 Handle<ObjectTemplateInfo> instance_template = |
| 2253 Handle<ObjectTemplateInfo>( | 2258 Handle<ObjectTemplateInfo>( |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2513 return Handle<Object>::null(); | 2518 return Handle<Object>::null(); |
| 2514 } | 2519 } |
| 2515 | 2520 |
| 2516 | 2521 |
| 2517 Handle<Object> Factory::ToBoolean(bool value) { | 2522 Handle<Object> Factory::ToBoolean(bool value) { |
| 2518 return value ? true_value() : false_value(); | 2523 return value ? true_value() : false_value(); |
| 2519 } | 2524 } |
| 2520 | 2525 |
| 2521 | 2526 |
| 2522 } } // namespace v8::internal | 2527 } } // namespace v8::internal |
| OLD | NEW |