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

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

Issue 1400193003: Don't assume at least one closure function is encountered before tree-shaking. Allow… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 Object& object = thread->ObjectHandle(); 2331 Object& object = thread->ObjectHandle();
2332 dispatcher_cache ^= invocation_dispatcher_cache(); 2332 dispatcher_cache ^= invocation_dispatcher_cache();
2333 object = dispatcher_cache.At(idx); 2333 object = dispatcher_cache.At(idx);
2334 if (!object.IsFunction()) { 2334 if (!object.IsFunction()) {
2335 return Function::null(); 2335 return Function::null();
2336 } 2336 }
2337 return Function::Cast(object).raw(); 2337 return Function::Cast(object).raw();
2338 } 2338 }
2339 2339
2340 2340
2341 void Class::set_closures(const GrowableObjectArray& value) const {
2342 StorePointer(&raw_ptr()->closure_functions_, value.raw());
2343 }
2344
2345
2341 void Class::AddClosureFunction(const Function& function) const { 2346 void Class::AddClosureFunction(const Function& function) const {
2342 GrowableObjectArray& closures = 2347 GrowableObjectArray& closures =
2343 GrowableObjectArray::Handle(raw_ptr()->closure_functions_); 2348 GrowableObjectArray::Handle(raw_ptr()->closure_functions_);
2344 if (closures.IsNull()) { 2349 if (closures.IsNull()) {
2345 closures = GrowableObjectArray::New(4, Heap::kOld); 2350 closures = GrowableObjectArray::New(4, Heap::kOld);
2346 StorePointer(&raw_ptr()->closure_functions_, closures.raw()); 2351 StorePointer(&raw_ptr()->closure_functions_, closures.raw());
2347 } 2352 }
2348 ASSERT(function.IsNonImplicitClosureFunction()); 2353 ASSERT(function.IsNonImplicitClosureFunction());
2349 ASSERT(function.Owner() == this->raw()); 2354 ASSERT(function.Owner() == this->raw());
2350 closures.Add(function, Heap::kOld); 2355 closures.Add(function, Heap::kOld);
(...skipping 19173 matching lines...) Expand 10 before | Expand all | Expand 10 after
21524 return tag_label.ToCString(); 21529 return tag_label.ToCString();
21525 } 21530 }
21526 21531
21527 21532
21528 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21533 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21529 Instance::PrintJSONImpl(stream, ref); 21534 Instance::PrintJSONImpl(stream, ref);
21530 } 21535 }
21531 21536
21532 21537
21533 } // namespace dart 21538 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698