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

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

Issue 8508035: For instanceof inline check against right hand class id possible and interface String for OneByte... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « no previous file | runtime/vm/code_generator_ia32.cc » ('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 (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/code_index_table.h" 7 #include "vm/code_index_table.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
11 #include "vm/dart_entry.h" 11 #include "vm/dart_entry.h"
12 #include "vm/exceptions.h" 12 #include "vm/exceptions.h"
13 #include "vm/ic_data.h" 13 #include "vm/ic_data.h"
14 #include "vm/object_store.h" 14 #include "vm/object_store.h"
15 #include "vm/resolver.h" 15 #include "vm/resolver.h"
16 #include "vm/runtime_entry.h" 16 #include "vm/runtime_entry.h"
17 #include "vm/stack_frame.h" 17 #include "vm/stack_frame.h"
18 #include "vm/verifier.h" 18 #include "vm/verifier.h"
19 19
20 namespace dart { 20 namespace dart {
21 21
22 DEFINE_FLAG(bool, inline_cache, true, "enable inline caches"); 22 DEFINE_FLAG(bool, inline_cache, true, "enable inline caches");
23 DEFINE_FLAG(bool, trace_deopt, false, "Trace deoptimization"); 23 DEFINE_FLAG(bool, trace_deopt, false, "Trace deoptimization");
24 DEFINE_FLAG(bool, trace_ic, false, "trace IC handling"); 24 DEFINE_FLAG(bool, trace_ic, false, "trace IC handling");
25 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); 25 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code.");
26 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls."); 26 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls.");
27 DECLARE_FLAG(int, deoptimization_counter_threshold); 27 DECLARE_FLAG(int, deoptimization_counter_threshold);
28 DECLARE_FLAG(bool, trace_type_checks);
28 29
29 30
30 const Array& CodeGenerator::ArgumentsDescriptor( 31 const Array& CodeGenerator::ArgumentsDescriptor(
31 int num_arguments, 32 int num_arguments,
32 const Array& optional_arguments_names) { 33 const Array& optional_arguments_names) {
33 const intptr_t num_named_args = 34 const intptr_t num_named_args =
34 optional_arguments_names.IsNull() ? 0 : optional_arguments_names.Length(); 35 optional_arguments_names.IsNull() ? 0 : optional_arguments_names.Length();
35 const intptr_t num_pos_args = num_arguments - num_named_args; 36 const intptr_t num_pos_args = num_arguments - num_named_args;
36 37
37 // Build the argument descriptor array, which consists of the total number of 38 // Build the argument descriptor array, which consists of the total number of
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 ASSERT(arguments.Count() == kInstanceofRuntimeEntry.argument_count()); 319 ASSERT(arguments.Count() == kInstanceofRuntimeEntry.argument_count());
319 const Instance& instance = Instance::CheckedHandle(arguments.At(0)); 320 const Instance& instance = Instance::CheckedHandle(arguments.At(0));
320 const Type& type = Type::CheckedHandle(arguments.At(1)); 321 const Type& type = Type::CheckedHandle(arguments.At(1));
321 const TypeArguments& type_instantiator = 322 const TypeArguments& type_instantiator =
322 TypeArguments::CheckedHandle(arguments.At(2)); 323 TypeArguments::CheckedHandle(arguments.At(2));
323 ASSERT(type.IsFinalized()); 324 ASSERT(type.IsFinalized());
324 ASSERT(!instance.IsNull()); 325 ASSERT(!instance.IsNull());
325 const Bool& result = Bool::Handle( 326 const Bool& result = Bool::Handle(
326 instance.IsInstanceOf(type, type_instantiator) ? 327 instance.IsInstanceOf(type, type_instantiator) ?
327 Bool::True() : Bool::False()); 328 Bool::True() : Bool::False());
329 if (FLAG_trace_type_checks) {
330 Class& cls = Class::Handle(instance.clazz());
331 // TODO(regis): Remove once all classes finalized.
332 if (cls.is_finalized()) {
333 OS::Print("InstanceOf '%s' %s '%s'\n",
334 String::Handle(Type::Handle(instance.GetType()).Name()).
335 ToCString(),
336 (result.raw() == Bool::True()) ? "is" : "is !",
337 String::Handle(type.Name()).ToCString());
338 }
339 }
328 arguments.SetReturn(result); 340 arguments.SetReturn(result);
329 } 341 }
330 342
331 343
332 DEFINE_RUNTIME_ENTRY(Throw, 1) { 344 DEFINE_RUNTIME_ENTRY(Throw, 1) {
333 ASSERT(arguments.Count() == kThrowRuntimeEntry.argument_count()); 345 ASSERT(arguments.Count() == kThrowRuntimeEntry.argument_count());
334 const Instance& exception = Instance::CheckedHandle(arguments.At(0)); 346 const Instance& exception = Instance::CheckedHandle(arguments.At(0));
335 Exceptions::Throw(exception); 347 Exceptions::Throw(exception);
336 } 348 }
337 349
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 } 993 }
982 } 994 }
983 } 995 }
984 // The cache is null terminated, therefore the loop above should never 996 // The cache is null terminated, therefore the loop above should never
985 // terminate by itself. 997 // terminate by itself.
986 UNREACHABLE(); 998 UNREACHABLE();
987 return Code::null(); 999 return Code::null();
988 } 1000 }
989 1001
990 } // namespace dart 1002 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/code_generator_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698