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

Side by Side Diff: vm/object.cc

Issue 9252033: Improve compilation times for swarm application startup. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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 | « vm/object.h ('k') | vm/parser.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 "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 } 1473 }
1474 ASSERT(test == kIsSubtypeOf); 1474 ASSERT(test == kIsSubtypeOf);
1475 1475
1476 // Check for "more specific" relation. 1476 // Check for "more specific" relation.
1477 return IsMoreSpecificThan(type_arguments, other, other_type_arguments); 1477 return IsMoreSpecificThan(type_arguments, other, other_type_arguments);
1478 } 1478 }
1479 1479
1480 1480
1481 RawFunction* Class::LookupDynamicFunction(const String& name) const { 1481 RawFunction* Class::LookupDynamicFunction(const String& name) const {
1482 Function& function = Function::Handle(LookupFunction(name)); 1482 Function& function = Function::Handle(LookupFunction(name));
1483 if (function.IsNull() || function.is_static()) { 1483 if (function.IsNull() || !function.IsDynamicFunction()) {
1484 return Function::null(); 1484 return Function::null();
1485 } 1485 }
1486 switch (function.kind()) { 1486 return function.raw();
1487 case RawFunction::kFunction:
1488 case RawFunction::kGetterFunction:
1489 case RawFunction::kSetterFunction:
1490 case RawFunction::kImplicitGetter:
1491 case RawFunction::kImplicitSetter:
1492 return function.raw();
1493 case RawFunction::kConstructor:
1494 case RawFunction::kConstImplicitGetter:
1495 case RawFunction::kAbstract:
1496 return Function::null();
1497 default:
1498 UNREACHABLE();
1499 return Function::null();
1500 }
1501 } 1487 }
1502 1488
1503 1489
1504 RawFunction* Class::LookupStaticFunction(const String& name) const { 1490 RawFunction* Class::LookupStaticFunction(const String& name) const {
1505 Function& function = Function::Handle(LookupFunction(name)); 1491 Function& function = Function::Handle(LookupFunction(name));
1506 if (function.IsNull() || !function.is_static()) { 1492 if (function.IsNull() || !function.IsStaticFunction()) {
1507 return Function::null(); 1493 return Function::null();
1508 } 1494 }
1509 switch (function.kind()) { 1495 return function.raw();
1510 case RawFunction::kFunction:
1511 case RawFunction::kGetterFunction:
1512 case RawFunction::kSetterFunction:
1513 case RawFunction::kImplicitGetter:
1514 case RawFunction::kImplicitSetter:
1515 case RawFunction::kConstImplicitGetter:
1516 return function.raw();
1517 case RawFunction::kConstructor:
1518 return Function::null();
1519 default:
1520 UNREACHABLE();
1521 return Function::null();
1522 }
1523 } 1496 }
1524 1497
1525 1498
1526 RawFunction* Class::LookupConstructor(const String& name) const { 1499 RawFunction* Class::LookupConstructor(const String& name) const {
1527 Function& function = Function::Handle(LookupFunction(name)); 1500 Function& function = Function::Handle(LookupFunction(name));
1528 if (function.IsNull() || !function.IsConstructor()) { 1501 if (function.IsNull() || !function.IsConstructor()) {
1529 return Function::null(); 1502 return Function::null();
1530 } 1503 }
1531 ASSERT(!function.is_static()); 1504 ASSERT(!function.is_static());
1532 return function.raw(); 1505 return function.raw();
(...skipping 5026 matching lines...) Expand 10 before | Expand all | Expand 10 after
6559 intptr_t len) { 6532 intptr_t len) {
6560 ASSERT(begin_index >= 0); 6533 ASSERT(begin_index >= 0);
6561 ASSERT(len >= 0); 6534 ASSERT(len >= 0);
6562 ASSERT((begin_index + len) <= str.Length()); 6535 ASSERT((begin_index + len) <= str.Length());
6563 Isolate* isolate = Isolate::Current(); 6536 Isolate* isolate = Isolate::Current();
6564 6537
6565 // Calculate the String hash for this sequence of characters. 6538 // Calculate the String hash for this sequence of characters.
6566 intptr_t hash = String::Hash(str, begin_index, len); 6539 intptr_t hash = String::Hash(str, begin_index, len);
6567 6540
6568 const Array& symbol_table = 6541 const Array& symbol_table =
6569 Array::Handle(isolate->object_store()->symbol_table()); 6542 Array::Handle(isolate, isolate->object_store()->symbol_table());
6570 // Last element of the array is the number of used elements. 6543 // Last element of the array is the number of used elements.
6571 intptr_t table_size = symbol_table.Length() - 1; 6544 intptr_t table_size = symbol_table.Length() - 1;
6572 intptr_t index = hash % table_size; 6545 intptr_t index = hash % table_size;
6573 6546
6574 String& symbol = String::Handle(); 6547 String& symbol = String::Handle(isolate, String::null());
6575 symbol ^= symbol_table.At(index); 6548 symbol ^= symbol_table.At(index);
6576 while (!symbol.IsNull() && !symbol.Equals(str, begin_index, len)) { 6549 while (!symbol.IsNull() && !symbol.Equals(str, begin_index, len)) {
6577 index = (index + 1) % table_size; // Move to next element. 6550 index = (index + 1) % table_size; // Move to next element.
6578 symbol ^= symbol_table.At(index); 6551 symbol ^= symbol_table.At(index);
6579 } 6552 }
6580 // Since we leave enough room in the table to guarantee, that we find an 6553 // Since we leave enough room in the table to guarantee, that we find an
6581 // empty spot, index is the insertion point if symbol is null. 6554 // empty spot, index is the insertion point if symbol is null.
6582 if (symbol.IsNull()) { 6555 if (symbol.IsNull()) {
6583 if (str.IsOld() && begin_index == 0 && len == str.Length()) { 6556 if (str.IsOld() && begin_index == 0 && len == str.Length()) {
6584 // Reuse the incoming str as the symbol value. 6557 // Reuse the incoming str as the symbol value.
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
7623 const String& str = String::Handle(pattern()); 7596 const String& str = String::Handle(pattern());
7624 const char* format = "JSRegExp: pattern=%s flags=%s"; 7597 const char* format = "JSRegExp: pattern=%s flags=%s";
7625 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 7598 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
7626 char* chars = reinterpret_cast<char*>( 7599 char* chars = reinterpret_cast<char*>(
7627 Isolate::Current()->current_zone()->Allocate(len + 1)); 7600 Isolate::Current()->current_zone()->Allocate(len + 1));
7628 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 7601 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
7629 return chars; 7602 return chars;
7630 } 7603 }
7631 7604
7632 } // namespace dart 7605 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.h ('k') | vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698