| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 private: | 357 private: |
| 358 Major MajorKey() { return SubString; } | 358 Major MajorKey() { return SubString; } |
| 359 int MinorKey() { return 0; } | 359 int MinorKey() { return 0; } |
| 360 | 360 |
| 361 void Generate(MacroAssembler* masm); | 361 void Generate(MacroAssembler* masm); |
| 362 }; | 362 }; |
| 363 | 363 |
| 364 | 364 |
| 365 class StringCompareStub: public CodeStub { | 365 class StringCompareStub: public CodeStub { |
| 366 public: | 366 public: |
| 367 explicit StringCompareStub() {} | 367 StringCompareStub() {} |
| 368 | 368 |
| 369 // Compare two flat ascii strings and returns result in rax after popping two | 369 // Compares two flat ASCII strings and returns result in rax. |
| 370 // arguments from the stack. | |
| 371 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, | 370 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm, |
| 372 Register left, | 371 Register left, |
| 373 Register right, | 372 Register right, |
| 374 Register scratch1, | 373 Register scratch1, |
| 375 Register scratch2, | 374 Register scratch2, |
| 376 Register scratch3, | 375 Register scratch3, |
| 377 Register scratch4); | 376 Register scratch4); |
| 378 | 377 |
| 378 // Compares two flat ASCII strings for equality and returns result |
| 379 // in rax. |
| 380 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm, |
| 381 Register left, |
| 382 Register right, |
| 383 Register scratch1, |
| 384 Register scratch2); |
| 385 |
| 379 private: | 386 private: |
| 380 Major MajorKey() { return StringCompare; } | 387 virtual Major MajorKey() { return StringCompare; } |
| 381 int MinorKey() { return 0; } | 388 virtual int MinorKey() { return 0; } |
| 389 virtual void Generate(MacroAssembler* masm); |
| 382 | 390 |
| 383 void Generate(MacroAssembler* masm); | 391 static void GenerateAsciiCharsCompareLoop(MacroAssembler* masm, |
| 392 Register left, |
| 393 Register right, |
| 394 Register length, |
| 395 Register scratch, |
| 396 NearLabel* chars_not_equal); |
| 384 }; | 397 }; |
| 385 | 398 |
| 386 | 399 |
| 387 class NumberToStringStub: public CodeStub { | 400 class NumberToStringStub: public CodeStub { |
| 388 public: | 401 public: |
| 389 NumberToStringStub() { } | 402 NumberToStringStub() { } |
| 390 | 403 |
| 391 // Generate code to do a lookup in the number string cache. If the number in | 404 // Generate code to do a lookup in the number string cache. If the number in |
| 392 // the register object is found in the cache the generated code falls through | 405 // the register object is found in the cache the generated code falls through |
| 393 // with the result in the result register. The object and the result register | 406 // with the result in the result register. The object and the result register |
| (...skipping 20 matching lines...) Expand all Loading... |
| 414 const char* GetName() { return "NumberToStringStub"; } | 427 const char* GetName() { return "NumberToStringStub"; } |
| 415 | 428 |
| 416 #ifdef DEBUG | 429 #ifdef DEBUG |
| 417 void Print() { | 430 void Print() { |
| 418 PrintF("NumberToStringStub\n"); | 431 PrintF("NumberToStringStub\n"); |
| 419 } | 432 } |
| 420 #endif | 433 #endif |
| 421 }; | 434 }; |
| 422 | 435 |
| 423 | 436 |
| 437 class StringDictionaryLookupStub: public CodeStub { |
| 438 public: |
| 439 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP }; |
| 440 |
| 441 StringDictionaryLookupStub(Register dictionary, |
| 442 Register result, |
| 443 Register index, |
| 444 LookupMode mode) |
| 445 : dictionary_(dictionary), result_(result), index_(index), mode_(mode) { } |
| 446 |
| 447 void Generate(MacroAssembler* masm); |
| 448 |
| 449 static void GenerateNegativeLookup(MacroAssembler* masm, |
| 450 Label* miss, |
| 451 Label* done, |
| 452 Register properties, |
| 453 String* name, |
| 454 Register r0); |
| 455 |
| 456 static void GeneratePositiveLookup(MacroAssembler* masm, |
| 457 Label* miss, |
| 458 Label* done, |
| 459 Register elements, |
| 460 Register name, |
| 461 Register r0, |
| 462 Register r1); |
| 463 |
| 464 private: |
| 465 static const int kInlinedProbes = 4; |
| 466 static const int kTotalProbes = 20; |
| 467 |
| 468 static const int kCapacityOffset = |
| 469 StringDictionary::kHeaderSize + |
| 470 StringDictionary::kCapacityIndex * kPointerSize; |
| 471 |
| 472 static const int kElementsStartOffset = |
| 473 StringDictionary::kHeaderSize + |
| 474 StringDictionary::kElementsStartIndex * kPointerSize; |
| 475 |
| 476 |
| 477 #ifdef DEBUG |
| 478 void Print() { |
| 479 PrintF("StringDictionaryLookupStub\n"); |
| 480 } |
| 481 #endif |
| 482 |
| 483 Major MajorKey() { return StringDictionaryNegativeLookup; } |
| 484 |
| 485 int MinorKey() { |
| 486 return DictionaryBits::encode(dictionary_.code()) | |
| 487 ResultBits::encode(result_.code()) | |
| 488 IndexBits::encode(index_.code()) | |
| 489 LookupModeBits::encode(mode_); |
| 490 } |
| 491 |
| 492 class DictionaryBits: public BitField<int, 0, 4> {}; |
| 493 class ResultBits: public BitField<int, 4, 4> {}; |
| 494 class IndexBits: public BitField<int, 8, 4> {}; |
| 495 class LookupModeBits: public BitField<LookupMode, 12, 1> {}; |
| 496 |
| 497 Register dictionary_; |
| 498 Register result_; |
| 499 Register index_; |
| 500 LookupMode mode_; |
| 501 }; |
| 502 |
| 503 |
| 424 } } // namespace v8::internal | 504 } } // namespace v8::internal |
| 425 | 505 |
| 426 #endif // V8_X64_CODE_STUBS_X64_H_ | 506 #endif // V8_X64_CODE_STUBS_X64_H_ |
| OLD | NEW |