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

Side by Side Diff: runtime/vm/code_generator.cc

Issue 21067002: Simplify allocation stub for closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // The current context was saved in the Isolate structure when entering the 282 // The current context was saved in the Isolate structure when entering the
283 // runtime. 283 // runtime.
284 const Context& context = Context::Handle(isolate->top_context()); 284 const Context& context = Context::Handle(isolate->top_context());
285 ASSERT(!context.IsNull()); 285 ASSERT(!context.IsNull());
286 const Instance& closure = Instance::Handle(Closure::New(function, context)); 286 const Instance& closure = Instance::Handle(Closure::New(function, context));
287 Closure::SetTypeArguments(closure, type_arguments); 287 Closure::SetTypeArguments(closure, type_arguments);
288 arguments.SetReturn(closure); 288 arguments.SetReturn(closure);
289 } 289 }
290 290
291 291
292 // Allocate a new implicit static closure.
293 // Arg0: local function.
294 // Return value: newly allocated closure.
295 DEFINE_RUNTIME_ENTRY(AllocateImplicitStaticClosure, 1) {
296 ASSERT(arguments.ArgCount() ==
297 kAllocateImplicitStaticClosureRuntimeEntry.argument_count());
298 ObjectStore* object_store = isolate->object_store();
299 ASSERT(object_store != NULL);
300 const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
301 ASSERT(!function.IsNull());
302 ASSERT(function.IsImplicitStaticClosureFunction());
303 const Context& context = Context::Handle(object_store->empty_context());
304 arguments.SetReturn(Instance::Handle(Closure::New(function, context)));
305 }
306
307
308 // Allocate a new implicit instance closure. 292 // Allocate a new implicit instance closure.
309 // Arg0: local function. 293 // Arg0: local function.
310 // Arg1: receiver object. 294 // Arg1: receiver object.
311 // Arg2: type arguments of the closure. 295 // Arg2: type arguments of the closure.
312 // Return value: newly allocated closure. 296 // Return value: newly allocated closure.
313 DEFINE_RUNTIME_ENTRY(AllocateImplicitInstanceClosure, 3) { 297 DEFINE_RUNTIME_ENTRY(AllocateImplicitInstanceClosure, 3) {
314 ASSERT(arguments.ArgCount() == 298 ASSERT(arguments.ArgCount() ==
315 kAllocateImplicitInstanceClosureRuntimeEntry.argument_count()); 299 kAllocateImplicitInstanceClosureRuntimeEntry.argument_count());
316 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); 300 const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
317 ASSERT(function.IsImplicitInstanceClosureFunction()); 301 ASSERT(function.IsImplicitInstanceClosureFunction());
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 // Arg1: Value that is being stored. 1897 // Arg1: Value that is being stored.
1914 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { 1898 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) {
1915 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); 1899 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count());
1916 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); 1900 const Field& field = Field::CheckedHandle(arguments.ArgAt(0));
1917 const Object& value = Object::Handle(arguments.ArgAt(1)); 1901 const Object& value = Object::Handle(arguments.ArgAt(1));
1918 1902
1919 field.UpdateCid(value.GetClassId()); 1903 field.UpdateCid(value.GetClassId());
1920 } 1904 }
1921 1905
1922 } // namespace dart 1906 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698