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

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

Issue 11893002: Improve compilation speed on a pathological case > 2x (7 sec -> 2.7 sec) by improving local lookups. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/scopes.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) 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 "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/assembler.h" 6 #include "vm/assembler.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after
2481 TEST_CASE(ContextScope) { 2481 TEST_CASE(ContextScope) {
2482 const intptr_t parent_scope_function_level = 0; 2482 const intptr_t parent_scope_function_level = 0;
2483 LocalScope* parent_scope = 2483 LocalScope* parent_scope =
2484 new LocalScope(NULL, parent_scope_function_level, 0); 2484 new LocalScope(NULL, parent_scope_function_level, 0);
2485 2485
2486 const intptr_t local_scope_function_level = 1; 2486 const intptr_t local_scope_function_level = 1;
2487 LocalScope* local_scope = 2487 LocalScope* local_scope =
2488 new LocalScope(parent_scope, local_scope_function_level, 0); 2488 new LocalScope(parent_scope, local_scope_function_level, 0);
2489 2489
2490 const Type& dynamic_type = Type::ZoneHandle(Type::DynamicType()); 2490 const Type& dynamic_type = Type::ZoneHandle(Type::DynamicType());
2491 const String& a = String::ZoneHandle(String::New("a")); 2491 const String& a = String::ZoneHandle(Symbols::New("a"));
2492 LocalVariable* var_a = 2492 LocalVariable* var_a =
2493 new LocalVariable(Scanner::kDummyTokenIndex, a, dynamic_type); 2493 new LocalVariable(Scanner::kDummyTokenIndex, a, dynamic_type);
2494 parent_scope->AddVariable(var_a); 2494 parent_scope->AddVariable(var_a);
2495 2495
2496 const String& b = String::ZoneHandle(String::New("b")); 2496 const String& b = String::ZoneHandle(Symbols::New("b"));
2497 LocalVariable* var_b = 2497 LocalVariable* var_b =
2498 new LocalVariable(Scanner::kDummyTokenIndex, b, dynamic_type); 2498 new LocalVariable(Scanner::kDummyTokenIndex, b, dynamic_type);
2499 local_scope->AddVariable(var_b); 2499 local_scope->AddVariable(var_b);
2500 2500
2501 const String& c = String::ZoneHandle(String::New("c")); 2501 const String& c = String::ZoneHandle(Symbols::New("c"));
2502 LocalVariable* var_c = 2502 LocalVariable* var_c =
2503 new LocalVariable(Scanner::kDummyTokenIndex, c, dynamic_type); 2503 new LocalVariable(Scanner::kDummyTokenIndex, c, dynamic_type);
2504 parent_scope->AddVariable(var_c); 2504 parent_scope->AddVariable(var_c);
2505 2505
2506 bool test_only = false; // Please, insert alias. 2506 bool test_only = false; // Please, insert alias.
2507 var_a = local_scope->LookupVariable(a, test_only); 2507 var_a = local_scope->LookupVariable(a, test_only);
2508 EXPECT(var_a->is_captured()); 2508 EXPECT(var_a->is_captured());
2509 EXPECT_EQ(parent_scope_function_level, var_a->owner()->function_level()); 2509 EXPECT_EQ(parent_scope_function_level, var_a->owner()->function_level());
2510 EXPECT(local_scope->LocalLookupVariable(a) == var_a); // Alias. 2510 EXPECT(local_scope->LocalLookupVariable(a) == var_a); // Alias.
2511 2511
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
3548 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); 3548 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint());
3549 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); 3549 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint());
3550 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); 3550 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint());
3551 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); 3551 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint());
3552 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); 3552 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint());
3553 } 3553 }
3554 3554
3555 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 3555 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
3556 3556
3557 } // namespace dart 3557 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698