Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 Register scratch3); | 370 Register scratch3); |
| 371 | 371 |
| 372 // Compares two flat ASCII strings for equality and returns result | 372 // Compares two flat ASCII strings for equality and returns result |
| 373 // in eax. | 373 // in eax. |
| 374 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, | 374 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, |
| 375 Register left, | 375 Register left, |
| 376 Register right, | 376 Register right, |
| 377 Register scratch1, | 377 Register scratch1, |
| 378 Register scratch2); | 378 Register scratch2); |
| 379 | 379 |
| 380 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, | |
| 381 Register left, | |
| 382 Register right, | |
| 383 Register scratch1, | |
| 384 Register scratch2, | |
| 385 Label* strings_not_equal); | |
| 386 | |
| 380 private: | 387 private: |
| 381 virtual Major MajorKey() { return StringCompare; } | 388 virtual Major MajorKey() { return StringCompare; } |
| 382 virtual int MinorKey() { return 0; } | 389 virtual int MinorKey() { return 0; } |
| 383 virtual void Generate(MacroAssembler* masm); | 390 virtual void Generate(MacroAssembler* masm); |
| 384 | 391 |
| 385 static void GenerateAsciiCharsCompareLoop( | 392 static void GenerateAsciiCharsCompareLoop( |
| 386 MacroAssembler* masm, | 393 MacroAssembler* masm, |
| 387 Register left, | 394 Register left, |
| 388 Register right, | 395 Register right, |
| 389 Register length, | 396 Register length, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 Register r0); | 446 Register r0); |
| 440 | 447 |
| 441 static void GeneratePositiveLookup(MacroAssembler* masm, | 448 static void GeneratePositiveLookup(MacroAssembler* masm, |
| 442 Label* miss, | 449 Label* miss, |
| 443 Label* done, | 450 Label* done, |
| 444 Register elements, | 451 Register elements, |
| 445 Register name, | 452 Register name, |
| 446 Register r0, | 453 Register r0, |
| 447 Register r1); | 454 Register r1); |
| 448 | 455 |
| 456 static void GenerateLookupWithComparisons(MacroAssembler* masm, | |
| 457 Register dictionary, | |
| 458 Register name, | |
| 459 Register scratch1, | |
| 460 Register scratch2, | |
| 461 Register scratch3, | |
| 462 Label* found_in_dictionary, | |
| 463 Label* not_found_in_dictionary, | |
| 464 Label* call_runtime); | |
| 465 | |
| 449 private: | 466 private: |
| 450 static const int kInlinedProbes = 4; | 467 static const int kInlinedProbes = 4; |
| 451 static const int kTotalProbes = 20; | 468 static const int kTotalProbes = 20; |
| 452 | 469 |
| 453 static const int kCapacityOffset = | 470 static const int kCapacityOffset = |
| 454 StringDictionary::kHeaderSize + | 471 StringDictionary::kHeaderSize + |
| 455 StringDictionary::kCapacityIndex * kPointerSize; | 472 StringDictionary::kCapacityIndex * kPointerSize; |
| 456 | 473 |
| 457 static const int kElementsStartOffset = | 474 static const int kElementsStartOffset = |
| 458 StringDictionary::kHeaderSize + | 475 StringDictionary::kHeaderSize + |
| 459 StringDictionary::kElementsStartIndex * kPointerSize; | 476 StringDictionary::kElementsStartIndex * kPointerSize; |
| 460 | 477 |
| 478 enum NameType { | |
| 479 NAME_IS_ASCII_STRING_WITH_HASH, | |
| 480 NAME_IS_ASCII_SYMBOL | |
| 481 }; | |
| 482 | |
| 461 Major MajorKey() { return StringDictionaryNegativeLookup; } | 483 Major MajorKey() { return StringDictionaryNegativeLookup; } |
| 462 | 484 |
| 463 int MinorKey() { | 485 int MinorKey() { |
| 464 return DictionaryBits::encode(dictionary_.code()) | | 486 return DictionaryBits::encode(dictionary_.code()) | |
| 465 ResultBits::encode(result_.code()) | | 487 ResultBits::encode(result_.code()) | |
| 466 IndexBits::encode(index_.code()) | | 488 IndexBits::encode(index_.code()) | |
| 467 LookupModeBits::encode(mode_); | 489 LookupModeBits::encode(mode_); |
| 468 } | 490 } |
| 469 | 491 |
| 492 static void GenerateUnrolledComparisons(MacroAssembler* masm, | |
| 493 NameType name_type, | |
| 494 Register dictionary, | |
| 495 Register name, | |
| 496 Register scratch1, | |
| 497 Register scratch2, | |
| 498 Register scratch3, | |
| 499 Label* found_in_dictionary, | |
| 500 Label* not_found_in_dictionary, | |
| 501 Label* call_runtime); | |
| 502 | |
| 470 class DictionaryBits: public BitField<int, 0, 3> {}; | 503 class DictionaryBits: public BitField<int, 0, 3> {}; |
| 471 class ResultBits: public BitField<int, 3, 3> {}; | 504 class ResultBits: public BitField<int, 3, 3> {}; |
| 472 class IndexBits: public BitField<int, 6, 3> {}; | 505 class IndexBits: public BitField<int, 6, 3> {}; |
| 473 class LookupModeBits: public BitField<LookupMode, 9, 1> {}; | 506 class LookupModeBits: public BitField<LookupMode, 9, 1> {}; |
| 474 | 507 |
| 475 Register dictionary_; | 508 Register dictionary_; |
| 476 Register result_; | 509 Register result_; |
| 477 Register index_; | 510 Register index_; |
| 478 LookupMode mode_; | 511 LookupMode mode_; |
| 479 }; | 512 }; |
| 480 | 513 |
| 481 | 514 |
| 515 class HasOwnPropertyStub: public CodeStub { | |
| 516 public: | |
| 517 HasOwnPropertyStub() {} | |
| 518 | |
| 519 virtual void Generate(MacroAssembler* masm); | |
| 520 virtual Major MajorKey() { return HasOwnProperty; } | |
| 521 virtual int MinorKey() { return 0; } | |
| 522 | |
| 523 private: | |
| 524 enum NameType { | |
| 525 NAME_IS_SYMBOL, | |
| 526 NAME_IS_SEQUENTIAL_ASCII | |
| 527 }; | |
| 528 | |
| 529 void GenerateFastPropertiesCase(MacroAssembler* masm, | |
| 530 Register map, | |
| 531 Register name, | |
| 532 Register scratch1, | |
| 533 Register scratch2, | |
| 534 Register scratch3, | |
| 535 Label* call_runtime); | |
| 536 | |
| 537 void GenerateSlowPropertiesCase(MacroAssembler* masm, | |
| 538 Register object, | |
| 539 Register name, | |
| 540 Register scratch1, | |
| 541 Register scratch2, | |
| 542 Register scratch3, | |
| 543 Label* call_runtime); | |
| 544 | |
| 545 // Generates a lookup in the descriptor array. Generated code | |
| 546 // returns true if the property is found, jumps to the given label | |
|
Mads Ager (chromium)
2011/07/15 09:04:45
the given label -> the not_found_in_descriptors la
| |
| 547 // otherwise. | |
| 548 void GenerateDescriptorArrayLookup(MacroAssembler* masm, | |
| 549 NameType name_type, | |
| 550 Register descriptor_array, | |
| 551 Register name, | |
| 552 Register scratch1, | |
| 553 Register scratch2, | |
| 554 Register scratch3, | |
| 555 Label* not_found_in_descriptors, | |
| 556 Label* call_runtime); | |
| 557 | |
| 558 DISALLOW_COPY_AND_ASSIGN(HasOwnPropertyStub); | |
| 559 }; | |
| 560 | |
| 482 } } // namespace v8::internal | 561 } } // namespace v8::internal |
| 483 | 562 |
| 484 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 563 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
| OLD | NEW |