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

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

Issue 620113002: Removed the Isolate* field from literal nodes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « src/ast-value-factory.h ('k') | no next file » | 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 int length = static_cast<int>(strlen(data)); 110 int length = static_cast<int>(strlen(data));
111 if (is_one_byte_ && literal_bytes_.length() == length) { 111 if (is_one_byte_ && literal_bytes_.length() == length) {
112 const char* token = reinterpret_cast<const char*>(literal_bytes_.start()); 112 const char* token = reinterpret_cast<const char*>(literal_bytes_.start());
113 return !strncmp(token, data, length); 113 return !strncmp(token, data, length);
114 } 114 }
115 return false; 115 return false;
116 } 116 }
117 117
118 118
119 bool AstRawString::Compare(void* a, void* b) { 119 bool AstRawString::Compare(void* a, void* b) {
120 AstRawString* string1 = reinterpret_cast<AstRawString*>(a); 120 return *static_cast<AstRawString*>(a) == *static_cast<AstRawString*>(b);
121 AstRawString* string2 = reinterpret_cast<AstRawString*>(b); 121 }
122 if (string1->is_one_byte_ != string2->is_one_byte_) return false; 122
123 if (string1->hash_ != string2->hash_) return false; 123 bool AstRawString::operator==(const AstRawString& rhs) const {
124 int length = string1->literal_bytes_.length(); 124 if (is_one_byte_ != rhs.is_one_byte_) return false;
125 if (string2->literal_bytes_.length() != length) return false; 125 if (hash_ != rhs.hash_) return false;
126 return memcmp(string1->literal_bytes_.start(), 126 int len = literal_bytes_.length();
127 string2->literal_bytes_.start(), length) == 0; 127 if (rhs.literal_bytes_.length() != len) return false;
128 return memcmp(literal_bytes_.start(), rhs.literal_bytes_.start(), len) == 0;
128 } 129 }
129 130
130 131
131 void AstConsString::Internalize(Isolate* isolate) { 132 void AstConsString::Internalize(Isolate* isolate) {
132 // AstRawStrings are internalized before AstConsStrings so left and right are 133 // AstRawStrings are internalized before AstConsStrings so left and right are
133 // already internalized. 134 // already internalized.
134 string_ = isolate->factory() 135 string_ = isolate->factory()
135 ->NewConsString(left_->string(), right_->string()) 136 ->NewConsString(left_->string(), right_->string())
136 .ToHandleChecked(); 137 .ToHandleChecked();
137 } 138 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if (isolate_) { 401 if (isolate_) {
401 new_string->Internalize(isolate_); 402 new_string->Internalize(isolate_);
402 } 403 }
403 entry->value = reinterpret_cast<void*>(1); 404 entry->value = reinterpret_cast<void*>(1);
404 } 405 }
405 return reinterpret_cast<AstRawString*>(entry->key); 406 return reinterpret_cast<AstRawString*>(entry->key);
406 } 407 }
407 408
408 409
409 } } // namespace v8::internal 410 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast-value-factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698