OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ast.h" | 5 #include "src/ast.h" |
6 | 6 |
7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
8 #include "src/builtins.h" | 8 #include "src/builtins.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 for (int i = properties()->length() - 1; i >= 0; i--) { | 264 for (int i = properties()->length() - 1; i >= 0; i--) { |
265 ObjectLiteral::Property* property = properties()->at(i); | 265 ObjectLiteral::Property* property = properties()->at(i); |
266 if (property->is_computed_name()) continue; | 266 if (property->is_computed_name()) continue; |
267 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) continue; | 267 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) continue; |
268 Literal* literal = property->key()->AsLiteral(); | 268 Literal* literal = property->key()->AsLiteral(); |
269 DCHECK(!literal->value()->IsNull()); | 269 DCHECK(!literal->value()->IsNull()); |
270 | 270 |
271 // If there is an existing entry do not emit a store unless the previous | 271 // If there is an existing entry do not emit a store unless the previous |
272 // entry was also an accessor. | 272 // entry was also an accessor. |
273 uint32_t hash = literal->Hash(); | 273 uint32_t hash = literal->Hash(); |
274 ZoneHashMap::Entry* entry = table.Lookup(literal, hash, true, allocator); | 274 ZoneHashMap::Entry* entry = table.LookupOrInsert(literal, hash, allocator); |
275 if (entry->value != NULL) { | 275 if (entry->value != NULL) { |
276 auto previous_kind = | 276 auto previous_kind = |
277 static_cast<ObjectLiteral::Property*>(entry->value)->kind(); | 277 static_cast<ObjectLiteral::Property*>(entry->value)->kind(); |
278 if (!((property->kind() == GETTER && previous_kind == SETTER) || | 278 if (!((property->kind() == GETTER && previous_kind == SETTER) || |
279 (property->kind() == SETTER && previous_kind == GETTER))) { | 279 (property->kind() == SETTER && previous_kind == GETTER))) { |
280 property->set_emit_store(false); | 280 property->set_emit_store(false); |
281 } | 281 } |
282 } | 282 } |
283 entry->value = property; | 283 entry->value = property; |
284 } | 284 } |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 // static | 1003 // static |
1004 bool Literal::Match(void* literal1, void* literal2) { | 1004 bool Literal::Match(void* literal1, void* literal2) { |
1005 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1005 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1006 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1006 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1007 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || | 1007 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || |
1008 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1008 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1009 } | 1009 } |
1010 | 1010 |
1011 | 1011 |
1012 } } // namespace v8::internal | 1012 } } // namespace v8::internal |
OLD | NEW |