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

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

Issue 351673002: Add class id constants fields to dart:_internal class 'ClassID'. Use the fields in the library (mor… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 4345 matching lines...) Expand 10 before | Expand all | Expand 10 after
4356 call->deopt_id(), 4356 call->deopt_id(),
4357 recognized_kind, 4357 recognized_kind,
4358 call->token_pos()); 4358 call->token_pos());
4359 ReplaceCall(call, invoke); 4359 ReplaceCall(call, invoke);
4360 } else if (recognized_kind == MethodRecognizer::kObjectArrayConstructor) { 4360 } else if (recognized_kind == MethodRecognizer::kObjectArrayConstructor) {
4361 Value* type = new(I) Value(call->ArgumentAt(0)); 4361 Value* type = new(I) Value(call->ArgumentAt(0));
4362 Value* num_elements = new(I) Value(call->ArgumentAt(1)); 4362 Value* num_elements = new(I) Value(call->ArgumentAt(1));
4363 CreateArrayInstr* create_array = 4363 CreateArrayInstr* create_array =
4364 new(I) CreateArrayInstr(call->token_pos(), type, num_elements); 4364 new(I) CreateArrayInstr(call->token_pos(), type, num_elements);
4365 ReplaceCall(call, create_array); 4365 ReplaceCall(call, create_array);
4366 } else if (Library::PrivateCoreLibName(Symbols::ClassId()).Equals(
4367 String::Handle(I, call->function().name()))) {
4368 // Check for core library get:_classId.
4369 intptr_t cid = Class::Handle(I, call->function().Owner()).id();
4370 // Currently only implemented for a subset of classes.
4371 ASSERT((cid == kOneByteStringCid) || (cid == kTwoByteStringCid) ||
4372 (cid == kExternalOneByteStringCid) ||
4373 (cid == kGrowableObjectArrayCid) ||
4374 (cid == kImmutableArrayCid) || (cid == kArrayCid));
4375 ConstantInstr* cid_instr =
4376 new(I) ConstantInstr(Smi::Handle(I, Smi::New(cid)));
4377 ReplaceCall(call, cid_instr);
4378 } else if (call->function().IsFactory()) { 4366 } else if (call->function().IsFactory()) {
4379 const Class& function_class = 4367 const Class& function_class =
4380 Class::Handle(I, call->function().Owner()); 4368 Class::Handle(I, call->function().Owner());
4381 if ((function_class.library() == Library::CoreLibrary()) || 4369 if ((function_class.library() == Library::CoreLibrary()) ||
4382 (function_class.library() == Library::TypedDataLibrary())) { 4370 (function_class.library() == Library::TypedDataLibrary())) {
4383 intptr_t cid = FactoryRecognizer::ResultCid(call->function()); 4371 intptr_t cid = FactoryRecognizer::ResultCid(call->function());
4384 switch (cid) { 4372 switch (cid) {
4385 case kArrayCid: { 4373 case kArrayCid: {
4386 Value* type = new(I) Value(call->ArgumentAt(0)); 4374 Value* type = new(I) Value(call->ArgumentAt(0));
4387 Value* num_elements = new(I) Value(call->ArgumentAt(1)); 4375 Value* num_elements = new(I) Value(call->ArgumentAt(1));
(...skipping 5442 matching lines...) Expand 10 before | Expand all | Expand 10 after
9830 } 9818 }
9831 9819
9832 // Insert materializations at environment uses. 9820 // Insert materializations at environment uses.
9833 for (intptr_t i = 0; i < exits.length(); i++) { 9821 for (intptr_t i = 0; i < exits.length(); i++) {
9834 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots); 9822 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *slots);
9835 } 9823 }
9836 } 9824 }
9837 9825
9838 9826
9839 } // namespace dart 9827 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698