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

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: Try new strategy (Option C) 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/d8.cc ('k') | src/frames.cc » ('j') | src/frames.cc » ('J')
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 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 } 1653 }
1654 } 1654 }
1655 1655
1656 array->set_elements(*elms); 1656 array->set_elements(*elms);
1657 array->set_length(Smi::FromInt(length)); 1657 array->set_length(Smi::FromInt(length));
1658 } 1658 }
1659 1659
1660 1660
1661 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject( 1661 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject(
1662 Handle<JSFunction> function) { 1662 Handle<JSFunction> function) {
1663 DCHECK(function->shared()->is_generator()); 1663 DCHECK(function->shared()->is_generator() || function->shared()->is_async());
1664 JSFunction::EnsureHasInitialMap(function); 1664 JSFunction::EnsureHasInitialMap(function);
1665 Handle<Map> map(function->initial_map()); 1665 Handle<Map> map(function->initial_map());
1666 DCHECK_EQ(JS_GENERATOR_OBJECT_TYPE, map->instance_type()); 1666 DCHECK_EQ(JS_GENERATOR_OBJECT_TYPE, map->instance_type());
1667 CALL_HEAP_FUNCTION( 1667 CALL_HEAP_FUNCTION(
1668 isolate(), 1668 isolate(),
1669 isolate()->heap()->AllocateJSObjectFromMap(*map), 1669 isolate()->heap()->AllocateJSObjectFromMap(*map),
1670 JSGeneratorObject); 1670 JSGeneratorObject);
1671 } 1671 }
1672 1672
1673 1673
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2059 DCHECK(IsValidFunctionKind(kind)); 2059 DCHECK(IsValidFunctionKind(kind));
2060 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo( 2060 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(
2061 name, code, IsConstructable(kind, scope_info->language_mode())); 2061 name, code, IsConstructable(kind, scope_info->language_mode()));
2062 shared->set_scope_info(*scope_info); 2062 shared->set_scope_info(*scope_info);
2063 shared->set_kind(kind); 2063 shared->set_kind(kind);
2064 shared->set_num_literals(number_of_literals); 2064 shared->set_num_literals(number_of_literals);
2065 if (IsGeneratorFunction(kind)) { 2065 if (IsGeneratorFunction(kind)) {
2066 shared->set_instance_class_name(isolate()->heap()->Generator_string()); 2066 shared->set_instance_class_name(isolate()->heap()->Generator_string());
2067 shared->DisableOptimization(kGenerator); 2067 shared->DisableOptimization(kGenerator);
2068 } 2068 }
2069 if (IsAsyncFunction(kind)) {
2070 shared->DisableOptimization(kGenerator);
caitp (gmail) 2016/04/26 22:01:30 Seems to be okay to not do this. Yield disables op
2071 }
2069 return shared; 2072 return shared;
2070 } 2073 }
2071 2074
2072 2075
2073 Handle<JSMessageObject> Factory::NewJSMessageObject( 2076 Handle<JSMessageObject> Factory::NewJSMessageObject(
2074 MessageTemplate::Template message, Handle<Object> argument, 2077 MessageTemplate::Template message, Handle<Object> argument,
2075 int start_position, int end_position, Handle<Object> script, 2078 int start_position, int end_position, Handle<Object> script,
2076 Handle<Object> stack_frames) { 2079 Handle<Object> stack_frames) {
2077 Handle<Map> map = message_object_map(); 2080 Handle<Map> map = message_object_map();
2078 Handle<JSMessageObject> message_obj = New<JSMessageObject>(map, NEW_SPACE); 2081 Handle<JSMessageObject> message_obj = New<JSMessageObject>(map, NEW_SPACE);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 } 2374 }
2372 2375
2373 2376
2374 Handle<Object> Factory::ToBoolean(bool value) { 2377 Handle<Object> Factory::ToBoolean(bool value) {
2375 return value ? true_value() : false_value(); 2378 return value ? true_value() : false_value();
2376 } 2379 }
2377 2380
2378 2381
2379 } // namespace internal 2382 } // namespace internal
2380 } // namespace v8 2383 } // namespace v8
OLDNEW
« no previous file with comments | « src/d8.cc ('k') | src/frames.cc » ('j') | src/frames.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698