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

Side by Side Diff: src/ast-value-factory.cc

Issue 1494293003: Version 4.7.80.25 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.7
Patch Set: Created 5 years 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
« no previous file with comments | « include/v8-version.h ('k') | test/mjsunit/regress/regress-4450.js » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "src/ast-value-factory.h" 28 #include "src/ast-value-factory.h"
29 29
30 #include "src/api.h" 30 #include "src/api.h"
31 #include "src/objects.h" 31 #include "src/objects.h"
32 #include "src/utils.h"
32 33
33 namespace v8 { 34 namespace v8 {
34 namespace internal { 35 namespace internal {
35 36
36 namespace { 37 namespace {
37 38
38 // For using StringToArrayIndex. 39 // For using StringToArrayIndex.
39 class OneByteStringStream { 40 class OneByteStringStream {
40 public: 41 public:
41 explicit OneByteStringStream(Vector<const byte> lb) : 42 explicit OneByteStringStream(Vector<const byte> lb) :
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 373 }
373 entry->value = reinterpret_cast<void*>(1); 374 entry->value = reinterpret_cast<void*>(1);
374 } 375 }
375 return reinterpret_cast<AstRawString*>(entry->key); 376 return reinterpret_cast<AstRawString*>(entry->key);
376 } 377 }
377 378
378 379
379 bool AstValueFactory::AstRawStringCompare(void* a, void* b) { 380 bool AstValueFactory::AstRawStringCompare(void* a, void* b) {
380 const AstRawString* lhs = static_cast<AstRawString*>(a); 381 const AstRawString* lhs = static_cast<AstRawString*>(a);
381 const AstRawString* rhs = static_cast<AstRawString*>(b); 382 const AstRawString* rhs = static_cast<AstRawString*>(b);
382 if (lhs->is_one_byte() != rhs->is_one_byte()) return false; 383 if (lhs->length() != rhs->length()) return false;
383 if (lhs->hash() != rhs->hash()) return false; 384 if (lhs->hash() != rhs->hash()) return false;
384 int len = lhs->byte_length(); 385 const unsigned char* l = lhs->raw_data();
385 if (rhs->byte_length() != len) return false; 386 const unsigned char* r = rhs->raw_data();
386 return memcmp(lhs->raw_data(), rhs->raw_data(), len) == 0; 387 size_t length = rhs->length();
388 if (lhs->is_one_byte()) {
389 if (rhs->is_one_byte()) {
390 return CompareCharsUnsigned(reinterpret_cast<const uint8_t*>(l),
391 reinterpret_cast<const uint8_t*>(r),
392 length) == 0;
393 } else {
394 return CompareCharsUnsigned(reinterpret_cast<const uint8_t*>(l),
395 reinterpret_cast<const uint16_t*>(r),
396 length) == 0;
397 }
398 } else {
399 if (rhs->is_one_byte()) {
400 return CompareCharsUnsigned(reinterpret_cast<const uint16_t*>(l),
401 reinterpret_cast<const uint8_t*>(r),
402 length) == 0;
403 } else {
404 return CompareCharsUnsigned(reinterpret_cast<const uint16_t*>(l),
405 reinterpret_cast<const uint16_t*>(r),
406 length) == 0;
407 }
408 }
387 } 409 }
388 } // namespace internal 410 } // namespace internal
389 } // namespace v8 411 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8-version.h ('k') | test/mjsunit/regress/regress-4450.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698