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

Side by Side Diff: src/factory.cc

Issue 1895603002: [esnext] prototype runtime implementation for async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@AsyncFunction
Patch Set: fix some nits Created 4 years, 7 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
« no previous file with comments | « src/contexts.h ('k') | src/globals.h » ('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/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 } 1655 }
1656 } 1656 }
1657 1657
1658 array->set_elements(*elms); 1658 array->set_elements(*elms);
1659 array->set_length(Smi::FromInt(length)); 1659 array->set_length(Smi::FromInt(length));
1660 } 1660 }
1661 1661
1662 1662
1663 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject( 1663 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject(
1664 Handle<JSFunction> function) { 1664 Handle<JSFunction> function) {
1665 DCHECK(function->shared()->is_generator()); 1665 DCHECK(function->shared()->is_resumable());
1666 JSFunction::EnsureHasInitialMap(function); 1666 JSFunction::EnsureHasInitialMap(function);
1667 Handle<Map> map(function->initial_map()); 1667 Handle<Map> map(function->initial_map());
1668 DCHECK_EQ(JS_GENERATOR_OBJECT_TYPE, map->instance_type()); 1668 DCHECK_EQ(JS_GENERATOR_OBJECT_TYPE, map->instance_type());
1669 CALL_HEAP_FUNCTION( 1669 CALL_HEAP_FUNCTION(
1670 isolate(), 1670 isolate(),
1671 isolate()->heap()->AllocateJSObjectFromMap(*map), 1671 isolate()->heap()->AllocateJSObjectFromMap(*map),
1672 JSGeneratorObject); 1672 JSGeneratorObject);
1673 } 1673 }
1674 1674
1675 1675
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2061 DCHECK(IsValidFunctionKind(kind)); 2061 DCHECK(IsValidFunctionKind(kind));
2062 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo( 2062 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(
2063 name, code, IsConstructable(kind, scope_info->language_mode())); 2063 name, code, IsConstructable(kind, scope_info->language_mode()));
2064 shared->set_scope_info(*scope_info); 2064 shared->set_scope_info(*scope_info);
2065 shared->set_kind(kind); 2065 shared->set_kind(kind);
2066 shared->set_num_literals(number_of_literals); 2066 shared->set_num_literals(number_of_literals);
2067 if (IsGeneratorFunction(kind)) { 2067 if (IsGeneratorFunction(kind)) {
2068 shared->set_instance_class_name(isolate()->heap()->Generator_string()); 2068 shared->set_instance_class_name(isolate()->heap()->Generator_string());
2069 shared->DisableOptimization(kGenerator); 2069 shared->DisableOptimization(kGenerator);
2070 } 2070 }
2071 if (IsAsyncFunction(kind)) {
2072 // TODO(caitp): Enable optimization of async functions when they are enabled
2073 // for generators functions.
2074 shared->DisableOptimization(kGenerator);
2075 }
2071 return shared; 2076 return shared;
2072 } 2077 }
2073 2078
2074 2079
2075 Handle<JSMessageObject> Factory::NewJSMessageObject( 2080 Handle<JSMessageObject> Factory::NewJSMessageObject(
2076 MessageTemplate::Template message, Handle<Object> argument, 2081 MessageTemplate::Template message, Handle<Object> argument,
2077 int start_position, int end_position, Handle<Object> script, 2082 int start_position, int end_position, Handle<Object> script,
2078 Handle<Object> stack_frames) { 2083 Handle<Object> stack_frames) {
2079 Handle<Map> map = message_object_map(); 2084 Handle<Map> map = message_object_map();
2080 Handle<JSMessageObject> message_obj = New<JSMessageObject>(map, NEW_SPACE); 2085 Handle<JSMessageObject> message_obj = New<JSMessageObject>(map, NEW_SPACE);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 } 2378 }
2374 2379
2375 2380
2376 Handle<Object> Factory::ToBoolean(bool value) { 2381 Handle<Object> Factory::ToBoolean(bool value) {
2377 return value ? true_value() : false_value(); 2382 return value ? true_value() : false_value();
2378 } 2383 }
2379 2384
2380 2385
2381 } // namespace internal 2386 } // namespace internal
2382 } // namespace v8 2387 } // namespace v8
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698