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/conversions.h" | 8 #include "src/conversions.h" |
8 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
9 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
10 | 11 |
11 namespace v8 { | 12 namespace v8 { |
12 namespace internal { | 13 namespace internal { |
13 | 14 |
14 | 15 |
15 template<typename T> | 16 template<typename T> |
16 Handle<T> Factory::New(Handle<Map> map, AllocationSpace space) { | 17 Handle<T> Factory::New(Handle<Map> map, AllocationSpace space) { |
(...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2079 debug_info->set_code(*code); | 2080 debug_info->set_code(*code); |
2080 debug_info->set_break_points(*break_points); | 2081 debug_info->set_break_points(*break_points); |
2081 | 2082 |
2082 // Link debug info to function. | 2083 // Link debug info to function. |
2083 shared->set_debug_info(*debug_info); | 2084 shared->set_debug_info(*debug_info); |
2084 | 2085 |
2085 return debug_info; | 2086 return debug_info; |
2086 } | 2087 } |
2087 | 2088 |
2088 | 2089 |
2089 Handle<JSObject> Factory::NewArgumentsObject(Handle<Object> callee, | 2090 Handle<JSObject> Factory::NewArgumentsObject(Handle<JSFunction> callee, |
2090 int length) { | 2091 int length) { |
2091 CALL_HEAP_FUNCTION( | 2092 bool strict_mode_callee = callee->shared()->strict_mode() == STRICT; |
2092 isolate(), | 2093 Handle<Map> map = strict_mode_callee ? isolate()->strict_arguments_map() |
2093 isolate()->heap()->AllocateArgumentsObject(*callee, length), JSObject); | 2094 : isolate()->sloppy_arguments_map(); |
| 2095 |
| 2096 AllocationSiteUsageContext context(isolate(), Handle<AllocationSite>(), |
| 2097 false); |
| 2098 ASSERT(!isolate()->has_pending_exception()); |
| 2099 Handle<JSObject> result = NewJSObjectFromMap(map); |
| 2100 Handle<Smi> value(Smi::FromInt(length), isolate()); |
| 2101 JSReceiver::SetProperty(result, length_string(), value, NONE, STRICT) |
| 2102 .Assert(); |
| 2103 if (!strict_mode_callee) { |
| 2104 JSReceiver::SetProperty(result, callee_string(), callee, NONE, STRICT) |
| 2105 .Assert(); |
| 2106 } |
| 2107 return result; |
2094 } | 2108 } |
2095 | 2109 |
2096 | 2110 |
2097 Handle<JSFunction> Factory::CreateApiFunction( | 2111 Handle<JSFunction> Factory::CreateApiFunction( |
2098 Handle<FunctionTemplateInfo> obj, | 2112 Handle<FunctionTemplateInfo> obj, |
2099 Handle<Object> prototype, | 2113 Handle<Object> prototype, |
2100 ApiInstanceType instance_type) { | 2114 ApiInstanceType instance_type) { |
2101 Handle<Code> code = isolate()->builtins()->HandleApiCall(); | 2115 Handle<Code> code = isolate()->builtins()->HandleApiCall(); |
2102 Handle<Code> construct_stub = isolate()->builtins()->JSConstructStubApi(); | 2116 Handle<Code> construct_stub = isolate()->builtins()->JSConstructStubApi(); |
2103 | 2117 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2367 return Handle<Object>::null(); | 2381 return Handle<Object>::null(); |
2368 } | 2382 } |
2369 | 2383 |
2370 | 2384 |
2371 Handle<Object> Factory::ToBoolean(bool value) { | 2385 Handle<Object> Factory::ToBoolean(bool value) { |
2372 return value ? true_value() : false_value(); | 2386 return value ? true_value() : false_value(); |
2373 } | 2387 } |
2374 | 2388 |
2375 | 2389 |
2376 } } // namespace v8::internal | 2390 } } // namespace v8::internal |
OLD | NEW |