| 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/conversions.h" |     8 #include "src/conversions.h" | 
|     9 #include "src/isolate-inl.h" |     9 #include "src/isolate-inl.h" | 
|    10 #include "src/macro-assembler.h" |    10 #include "src/macro-assembler.h" | 
| (...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1223                                  Handle<SharedFunctionInfo> info, |  1223                                  Handle<SharedFunctionInfo> info, | 
|  1224                                  Handle<Context> context) { |  1224                                  Handle<Context> context) { | 
|  1225   function->initialize_properties(); |  1225   function->initialize_properties(); | 
|  1226   function->initialize_elements(); |  1226   function->initialize_elements(); | 
|  1227   function->set_shared(*info); |  1227   function->set_shared(*info); | 
|  1228   function->set_code(info->code()); |  1228   function->set_code(info->code()); | 
|  1229   function->set_context(*context); |  1229   function->set_context(*context); | 
|  1230   function->set_prototype_or_initial_map(*the_hole_value()); |  1230   function->set_prototype_or_initial_map(*the_hole_value()); | 
|  1231   function->set_literals_or_bindings(*empty_fixed_array()); |  1231   function->set_literals_or_bindings(*empty_fixed_array()); | 
|  1232   function->set_next_function_link(*undefined_value()); |  1232   function->set_next_function_link(*undefined_value()); | 
 |  1233   if (info->is_arrow()) function->RemovePrototype(); | 
|  1233 } |  1234 } | 
|  1234  |  1235  | 
|  1235  |  1236  | 
|  1236 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, |  1237 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, | 
|  1237                                         Handle<SharedFunctionInfo> info, |  1238                                         Handle<SharedFunctionInfo> info, | 
|  1238                                         Handle<Context> context, |  1239                                         Handle<Context> context, | 
|  1239                                         PretenureFlag pretenure) { |  1240                                         PretenureFlag pretenure) { | 
|  1240   AllocationSpace space = pretenure == TENURED ? OLD_POINTER_SPACE : NEW_SPACE; |  1241   AllocationSpace space = pretenure == TENURED ? OLD_POINTER_SPACE : NEW_SPACE; | 
|  1241   Handle<JSFunction> result = New<JSFunction>(map, space); |  1242   Handle<JSFunction> result = New<JSFunction>(map, space); | 
|  1242   InitializeFunction(result, info, context); |  1243   InitializeFunction(result, info, context); | 
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1882       isolate(), |  1883       isolate(), | 
|  1883       isolate()->heap()->AllocateFixedArrayWithFiller( |  1884       isolate()->heap()->AllocateFixedArrayWithFiller( | 
|  1884           slot_count, |  1885           slot_count, | 
|  1885           TENURED, |  1886           TENURED, | 
|  1886           *TypeFeedbackInfo::UninitializedSentinel(isolate())), |  1887           *TypeFeedbackInfo::UninitializedSentinel(isolate())), | 
|  1887       FixedArray); |  1888       FixedArray); | 
|  1888 } |  1889 } | 
|  1889  |  1890  | 
|  1890  |  1891  | 
|  1891 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( |  1892 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( | 
|  1892     Handle<String> name, |  1893     Handle<String> name, int number_of_literals, bool is_generator, | 
|  1893     int number_of_literals, |  1894     bool is_arrow, Handle<Code> code, Handle<ScopeInfo> scope_info, | 
|  1894     bool is_generator, |  | 
|  1895     Handle<Code> code, |  | 
|  1896     Handle<ScopeInfo> scope_info, |  | 
|  1897     Handle<FixedArray> feedback_vector) { |  1895     Handle<FixedArray> feedback_vector) { | 
|  1898   Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code); |  1896   Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code); | 
|  1899   shared->set_scope_info(*scope_info); |  1897   shared->set_scope_info(*scope_info); | 
|  1900   shared->set_feedback_vector(*feedback_vector); |  1898   shared->set_feedback_vector(*feedback_vector); | 
 |  1899   shared->set_is_arrow(is_arrow); | 
|  1901   int literals_array_size = number_of_literals; |  1900   int literals_array_size = number_of_literals; | 
|  1902   // If the function contains object, regexp or array literals, |  1901   // If the function contains object, regexp or array literals, | 
|  1903   // allocate extra space for a literals array prefix containing the |  1902   // allocate extra space for a literals array prefix containing the | 
|  1904   // context. |  1903   // context. | 
|  1905   if (number_of_literals > 0) { |  1904   if (number_of_literals > 0) { | 
|  1906     literals_array_size += JSFunction::kLiteralsPrefixSize; |  1905     literals_array_size += JSFunction::kLiteralsPrefixSize; | 
|  1907   } |  1906   } | 
|  1908   shared->set_num_literals(literals_array_size); |  1907   shared->set_num_literals(literals_array_size); | 
|  1909   if (is_generator) { |  1908   if (is_generator) { | 
|  1910     shared->set_instance_class_name(isolate()->heap()->Generator_string()); |  1909     shared->set_instance_class_name(isolate()->heap()->Generator_string()); | 
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2381   return Handle<Object>::null(); |  2380   return Handle<Object>::null(); | 
|  2382 } |  2381 } | 
|  2383  |  2382  | 
|  2384  |  2383  | 
|  2385 Handle<Object> Factory::ToBoolean(bool value) { |  2384 Handle<Object> Factory::ToBoolean(bool value) { | 
|  2386   return value ? true_value() : false_value(); |  2385   return value ? true_value() : false_value(); | 
|  2387 } |  2386 } | 
|  2388  |  2387  | 
|  2389  |  2388  | 
|  2390 } }  // namespace v8::internal |  2389 } }  // namespace v8::internal | 
| OLD | NEW |