| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 // Note: A lot of the helper functions below will vanish when we use virtual | 141 // Note: A lot of the helper functions below will vanish when we use virtual |
| 142 // function instead of switch more often. | 142 // function instead of switch more often. |
| 143 void Generate(MacroAssembler* masm); | 143 void Generate(MacroAssembler* masm); |
| 144 | 144 |
| 145 void GenerateTypeTransition(MacroAssembler* masm); | 145 void GenerateTypeTransition(MacroAssembler* masm); |
| 146 | 146 |
| 147 void GenerateSmiStub(MacroAssembler* masm); | 147 void GenerateSmiStub(MacroAssembler* masm); |
| 148 void GenerateSmiStubSub(MacroAssembler* masm); | 148 void GenerateSmiStubSub(MacroAssembler* masm); |
| 149 void GenerateSmiStubBitNot(MacroAssembler* masm); | 149 void GenerateSmiStubBitNot(MacroAssembler* masm); |
| 150 void GenerateSmiCodeSub(MacroAssembler* masm, NearLabel* non_smi, Label* undo, | 150 void GenerateSmiCodeSub(MacroAssembler* masm, |
| 151 Label* slow); | 151 Label* non_smi, |
| 152 void GenerateSmiCodeBitNot(MacroAssembler* masm, NearLabel* non_smi); | 152 Label* undo, |
| 153 Label* slow, |
| 154 Label::Distance non_smi_near = Label::kFar, |
| 155 Label::Distance undo_near = Label::kFar, |
| 156 Label::Distance slow_near = Label::kFar); |
| 157 void GenerateSmiCodeBitNot(MacroAssembler* masm, |
| 158 Label* non_smi, |
| 159 Label::Distance non_smi_near = Label::kFar); |
| 153 void GenerateSmiCodeUndo(MacroAssembler* masm); | 160 void GenerateSmiCodeUndo(MacroAssembler* masm); |
| 154 | 161 |
| 155 void GenerateHeapNumberStub(MacroAssembler* masm); | 162 void GenerateHeapNumberStub(MacroAssembler* masm); |
| 156 void GenerateHeapNumberStubSub(MacroAssembler* masm); | 163 void GenerateHeapNumberStubSub(MacroAssembler* masm); |
| 157 void GenerateHeapNumberStubBitNot(MacroAssembler* masm); | 164 void GenerateHeapNumberStubBitNot(MacroAssembler* masm); |
| 158 void GenerateHeapNumberCodeSub(MacroAssembler* masm, Label* slow); | 165 void GenerateHeapNumberCodeSub(MacroAssembler* masm, Label* slow); |
| 159 void GenerateHeapNumberCodeBitNot(MacroAssembler* masm, Label* slow); | 166 void GenerateHeapNumberCodeBitNot(MacroAssembler* masm, Label* slow); |
| 160 | 167 |
| 161 void GenerateGenericStub(MacroAssembler* masm); | 168 void GenerateGenericStub(MacroAssembler* masm); |
| 162 void GenerateGenericStubSub(MacroAssembler* masm); | 169 void GenerateGenericStubSub(MacroAssembler* masm); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 private: | 387 private: |
| 381 Major MajorKey() { return SubString; } | 388 Major MajorKey() { return SubString; } |
| 382 int MinorKey() { return 0; } | 389 int MinorKey() { return 0; } |
| 383 | 390 |
| 384 void Generate(MacroAssembler* masm); | 391 void Generate(MacroAssembler* masm); |
| 385 }; | 392 }; |
| 386 | 393 |
| 387 | 394 |
| 388 class StringCompareStub: public CodeStub { | 395 class StringCompareStub: public CodeStub { |
| 389 public: | 396 public: |
| 390 explicit StringCompareStub() { | 397 StringCompareStub() { } |
| 391 } | |
| 392 | 398 |
| 393 // Compare two flat ascii strings and returns result in eax after popping two | 399 // Compares two flat ASCII strings and returns result in eax. |
| 394 // arguments from the stack. | |
| 395 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, | 400 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, |
| 396 Register left, | 401 Register left, |
| 397 Register right, | 402 Register right, |
| 398 Register scratch1, | 403 Register scratch1, |
| 399 Register scratch2, | 404 Register scratch2, |
| 400 Register scratch3); | 405 Register scratch3); |
| 401 | 406 |
| 407 // Compares two flat ASCII strings for equality and returns result |
| 408 // in eax. |
| 409 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, |
| 410 Register left, |
| 411 Register right, |
| 412 Register scratch1, |
| 413 Register scratch2); |
| 414 |
| 402 private: | 415 private: |
| 403 Major MajorKey() { return StringCompare; } | 416 virtual Major MajorKey() { return StringCompare; } |
| 404 int MinorKey() { return 0; } | 417 virtual int MinorKey() { return 0; } |
| 418 virtual void Generate(MacroAssembler* masm); |
| 405 | 419 |
| 406 void Generate(MacroAssembler* masm); | 420 static void GenerateAsciiCharsCompareLoop( |
| 421 MacroAssembler* masm, |
| 422 Register left, |
| 423 Register right, |
| 424 Register length, |
| 425 Register scratch, |
| 426 Label* chars_not_equal, |
| 427 Label::Distance chars_not_equal_near = Label::kFar); |
| 407 }; | 428 }; |
| 408 | 429 |
| 409 | 430 |
| 410 class NumberToStringStub: public CodeStub { | 431 class NumberToStringStub: public CodeStub { |
| 411 public: | 432 public: |
| 412 NumberToStringStub() { } | 433 NumberToStringStub() { } |
| 413 | 434 |
| 414 // Generate code to do a lookup in the number string cache. If the number in | 435 // Generate code to do a lookup in the number string cache. If the number in |
| 415 // the register object is found in the cache the generated code falls through | 436 // the register object is found in the cache the generated code falls through |
| 416 // with the result in the result register. The object and the result register | 437 // with the result in the result register. The object and the result register |
| (...skipping 16 matching lines...) Expand all Loading... |
| 433 const char* GetName() { return "NumberToStringStub"; } | 454 const char* GetName() { return "NumberToStringStub"; } |
| 434 | 455 |
| 435 #ifdef DEBUG | 456 #ifdef DEBUG |
| 436 void Print() { | 457 void Print() { |
| 437 PrintF("NumberToStringStub\n"); | 458 PrintF("NumberToStringStub\n"); |
| 438 } | 459 } |
| 439 #endif | 460 #endif |
| 440 }; | 461 }; |
| 441 | 462 |
| 442 | 463 |
| 464 class StringDictionaryLookupStub: public CodeStub { |
| 465 public: |
| 466 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; |
| 467 |
| 468 StringDictionaryLookupStub(Register dictionary, |
| 469 Register result, |
| 470 Register index, |
| 471 LookupMode mode) |
| 472 : dictionary_(dictionary), result_(result), index_(index), mode_(mode) { } |
| 473 |
| 474 void Generate(MacroAssembler* masm); |
| 475 |
| 476 MUST_USE_RESULT static MaybeObject* GenerateNegativeLookup( |
| 477 MacroAssembler* masm, |
| 478 Label* miss, |
| 479 Label* done, |
| 480 Register properties, |
| 481 String* name, |
| 482 Register r0); |
| 483 |
| 484 static void GeneratePositiveLookup(MacroAssembler* masm, |
| 485 Label* miss, |
| 486 Label* done, |
| 487 Register elements, |
| 488 Register name, |
| 489 Register r0, |
| 490 Register r1); |
| 491 |
| 492 private: |
| 493 static const int kInlinedProbes = 4; |
| 494 static const int kTotalProbes = 20; |
| 495 |
| 496 static const int kCapacityOffset = |
| 497 StringDictionary::kHeaderSize + |
| 498 StringDictionary::kCapacityIndex * kPointerSize; |
| 499 |
| 500 static const int kElementsStartOffset = |
| 501 StringDictionary::kHeaderSize + |
| 502 StringDictionary::kElementsStartIndex * kPointerSize; |
| 503 |
| 504 |
| 505 #ifdef DEBUG |
| 506 void Print() { |
| 507 PrintF("StringDictionaryLookupStub\n"); |
| 508 } |
| 509 #endif |
| 510 |
| 511 Major MajorKey() { return StringDictionaryNegativeLookup; } |
| 512 |
| 513 int MinorKey() { |
| 514 return DictionaryBits::encode(dictionary_.code()) | |
| 515 ResultBits::encode(result_.code()) | |
| 516 IndexBits::encode(index_.code()) | |
| 517 LookupModeBits::encode(mode_); |
| 518 } |
| 519 |
| 520 class DictionaryBits: public BitField<int, 0, 3> {}; |
| 521 class ResultBits: public BitField<int, 3, 3> {}; |
| 522 class IndexBits: public BitField<int, 6, 3> {}; |
| 523 class LookupModeBits: public BitField<LookupMode, 9, 1> {}; |
| 524 |
| 525 Register dictionary_; |
| 526 Register result_; |
| 527 Register index_; |
| 528 LookupMode mode_; |
| 529 }; |
| 443 class RecordWriteStub: public CodeStub { | 530 class RecordWriteStub: public CodeStub { |
| 444 public: | 531 public: |
| 445 RecordWriteStub(Register object, | 532 RecordWriteStub(Register object, |
| 446 Register value, | 533 Register value, |
| 447 Register address, | 534 Register address, |
| 448 EmitRememberedSet emit_remembered_set, | 535 EmitRememberedSet emit_remembered_set, |
| 449 SaveFPRegsMode fp_mode) | 536 SaveFPRegsMode fp_mode) |
| 450 : object_(object), | 537 : object_(object), |
| 451 value_(value), | 538 value_(value), |
| 452 address_(address), | 539 address_(address), |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 Register scratch1, | 778 Register scratch1, |
| 692 bool load_elements_from_receiver, | 779 bool load_elements_from_receiver, |
| 693 Label* key_not_smi, | 780 Label* key_not_smi, |
| 694 Label* value_not_smi, | 781 Label* value_not_smi, |
| 695 Label* not_pixel_array, | 782 Label* not_pixel_array, |
| 696 Label* out_of_range); | 783 Label* out_of_range); |
| 697 | 784 |
| 698 } } // namespace v8::internal | 785 } } // namespace v8::internal |
| 699 | 786 |
| 700 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 787 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
| OLD | NEW |