Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: src/factory.cc

Issue 382893003: Implement basic code generation for arrow functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Test failures fixed, some minor corrections Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/factory.h ('k') | src/full-codegen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 Handle<SharedFunctionInfo> info, 1210 Handle<SharedFunctionInfo> info,
1211 Handle<Context> context) { 1211 Handle<Context> context) {
1212 function->initialize_properties(); 1212 function->initialize_properties();
1213 function->initialize_elements(); 1213 function->initialize_elements();
1214 function->set_shared(*info); 1214 function->set_shared(*info);
1215 function->set_code(info->code()); 1215 function->set_code(info->code());
1216 function->set_context(*context); 1216 function->set_context(*context);
1217 function->set_prototype_or_initial_map(*the_hole_value()); 1217 function->set_prototype_or_initial_map(*the_hole_value());
1218 function->set_literals_or_bindings(*empty_fixed_array()); 1218 function->set_literals_or_bindings(*empty_fixed_array());
1219 function->set_next_function_link(*undefined_value()); 1219 function->set_next_function_link(*undefined_value());
1220 if (info->is_arrow()) function->RemovePrototype();
1220 } 1221 }
1221 1222
1222 1223
1223 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, 1224 Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
1224 Handle<SharedFunctionInfo> info, 1225 Handle<SharedFunctionInfo> info,
1225 Handle<Context> context, 1226 Handle<Context> context,
1226 PretenureFlag pretenure) { 1227 PretenureFlag pretenure) {
1227 AllocationSpace space = pretenure == TENURED ? OLD_POINTER_SPACE : NEW_SPACE; 1228 AllocationSpace space = pretenure == TENURED ? OLD_POINTER_SPACE : NEW_SPACE;
1228 Handle<JSFunction> result = New<JSFunction>(map, space); 1229 Handle<JSFunction> result = New<JSFunction>(map, space);
1229 InitializeFunction(result, info, context); 1230 InitializeFunction(result, info, context);
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 isolate(), 1870 isolate(),
1870 isolate()->heap()->AllocateFixedArrayWithFiller( 1871 isolate()->heap()->AllocateFixedArrayWithFiller(
1871 slot_count, 1872 slot_count,
1872 TENURED, 1873 TENURED,
1873 *TypeFeedbackInfo::UninitializedSentinel(isolate())), 1874 *TypeFeedbackInfo::UninitializedSentinel(isolate())),
1874 FixedArray); 1875 FixedArray);
1875 } 1876 }
1876 1877
1877 1878
1878 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( 1879 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
1879 Handle<String> name, 1880 Handle<String> name, int number_of_literals, bool is_generator,
1880 int number_of_literals, 1881 bool is_arrow, Handle<Code> code, Handle<ScopeInfo> scope_info,
1881 bool is_generator,
1882 Handle<Code> code,
1883 Handle<ScopeInfo> scope_info,
1884 Handle<FixedArray> feedback_vector) { 1882 Handle<FixedArray> feedback_vector) {
1885 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code); 1883 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code);
1886 shared->set_scope_info(*scope_info); 1884 shared->set_scope_info(*scope_info);
1887 shared->set_feedback_vector(*feedback_vector); 1885 shared->set_feedback_vector(*feedback_vector);
1886 shared->set_is_arrow(is_arrow);
1888 int literals_array_size = number_of_literals; 1887 int literals_array_size = number_of_literals;
1889 // If the function contains object, regexp or array literals, 1888 // If the function contains object, regexp or array literals,
1890 // allocate extra space for a literals array prefix containing the 1889 // allocate extra space for a literals array prefix containing the
1891 // context. 1890 // context.
1892 if (number_of_literals > 0) { 1891 if (number_of_literals > 0) {
1893 literals_array_size += JSFunction::kLiteralsPrefixSize; 1892 literals_array_size += JSFunction::kLiteralsPrefixSize;
1894 } 1893 }
1895 shared->set_num_literals(literals_array_size); 1894 shared->set_num_literals(literals_array_size);
1896 if (is_generator) { 1895 if (is_generator) {
1897 shared->set_instance_class_name(isolate()->heap()->Generator_string()); 1896 shared->set_instance_class_name(isolate()->heap()->Generator_string());
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 return Handle<Object>::null(); 2365 return Handle<Object>::null();
2367 } 2366 }
2368 2367
2369 2368
2370 Handle<Object> Factory::ToBoolean(bool value) { 2369 Handle<Object> Factory::ToBoolean(bool value) {
2371 return value ? true_value() : false_value(); 2370 return value ? true_value() : false_value();
2372 } 2371 }
2373 2372
2374 2373
2375 } } // namespace v8::internal 2374 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698