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