| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 void ObjectLiteral::Property::set_emit_store(bool emit_store) { | 227 void ObjectLiteral::Property::set_emit_store(bool emit_store) { |
| 228 emit_store_ = emit_store; | 228 emit_store_ = emit_store; |
| 229 } | 229 } |
| 230 | 230 |
| 231 | 231 |
| 232 bool ObjectLiteral::Property::emit_store() { | 232 bool ObjectLiteral::Property::emit_store() { |
| 233 return emit_store_; | 233 return emit_store_; |
| 234 } | 234 } |
| 235 | 235 |
| 236 | 236 |
| 237 bool IsEqualString(void* first, void* second) { | |
| 238 ASSERT((*reinterpret_cast<String**>(first))->IsString()); | |
| 239 ASSERT((*reinterpret_cast<String**>(second))->IsString()); | |
| 240 Handle<String> h1(reinterpret_cast<String**>(first)); | |
| 241 Handle<String> h2(reinterpret_cast<String**>(second)); | |
| 242 return (*h1)->Equals(*h2); | |
| 243 } | |
| 244 | |
| 245 | |
| 246 bool IsEqualNumber(void* first, void* second) { | |
| 247 ASSERT((*reinterpret_cast<Object**>(first))->IsNumber()); | |
| 248 ASSERT((*reinterpret_cast<Object**>(second))->IsNumber()); | |
| 249 | |
| 250 Handle<Object> h1(reinterpret_cast<Object**>(first)); | |
| 251 Handle<Object> h2(reinterpret_cast<Object**>(second)); | |
| 252 if (h1->IsSmi()) { | |
| 253 return h2->IsSmi() && *h1 == *h2; | |
| 254 } | |
| 255 if (h2->IsSmi()) return false; | |
| 256 Handle<HeapNumber> n1 = Handle<HeapNumber>::cast(h1); | |
| 257 Handle<HeapNumber> n2 = Handle<HeapNumber>::cast(h2); | |
| 258 ASSERT(std::isfinite(n1->value())); | |
| 259 ASSERT(std::isfinite(n2->value())); | |
| 260 return n1->value() == n2->value(); | |
| 261 } | |
| 262 | |
| 263 | |
| 264 void ObjectLiteral::CalculateEmitStore(Zone* zone) { | 237 void ObjectLiteral::CalculateEmitStore(Zone* zone) { |
| 265 ZoneAllocationPolicy allocator(zone); | 238 ZoneAllocationPolicy allocator(zone); |
| 266 | 239 |
| 267 ZoneHashMap table(Literal::Match, ZoneHashMap::kDefaultHashMapCapacity, | 240 ZoneHashMap table(Literal::Match, ZoneHashMap::kDefaultHashMapCapacity, |
| 268 allocator); | 241 allocator); |
| 269 for (int i = properties()->length() - 1; i >= 0; i--) { | 242 for (int i = properties()->length() - 1; i >= 0; i--) { |
| 270 ObjectLiteral::Property* property = properties()->at(i); | 243 ObjectLiteral::Property* property = properties()->at(i); |
| 271 Literal* literal = property->key(); | 244 Literal* literal = property->key(); |
| 272 if (literal->value()->IsNull()) continue; | 245 if (literal->value()->IsNull()) continue; |
| 273 uint32_t hash = literal->Hash(); | 246 uint32_t hash = literal->Hash(); |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1160 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
| 1188 str = arr; | 1161 str = arr; |
| 1189 } else { | 1162 } else { |
| 1190 str = DoubleToCString(value_->Number(), buffer); | 1163 str = DoubleToCString(value_->Number(), buffer); |
| 1191 } | 1164 } |
| 1192 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); | 1165 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); |
| 1193 } | 1166 } |
| 1194 | 1167 |
| 1195 | 1168 |
| 1196 } } // namespace v8::internal | 1169 } } // namespace v8::internal |
| OLD | NEW |