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

Side by Side Diff: src/ast.cc

Issue 9372106: Make HashMap a template class to specify the allocation policy. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 10 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
OLDNEW
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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if (h2->IsSmi()) return false; 230 if (h2->IsSmi()) return false;
231 Handle<HeapNumber> n1 = Handle<HeapNumber>::cast(h1); 231 Handle<HeapNumber> n1 = Handle<HeapNumber>::cast(h1);
232 Handle<HeapNumber> n2 = Handle<HeapNumber>::cast(h2); 232 Handle<HeapNumber> n2 = Handle<HeapNumber>::cast(h2);
233 ASSERT(isfinite(n1->value())); 233 ASSERT(isfinite(n1->value()));
234 ASSERT(isfinite(n2->value())); 234 ASSERT(isfinite(n2->value()));
235 return n1->value() == n2->value(); 235 return n1->value() == n2->value();
236 } 236 }
237 237
238 238
239 void ObjectLiteral::CalculateEmitStore() { 239 void ObjectLiteral::CalculateEmitStore() {
240 HashMap properties(&IsEqualString); 240 ZoneHashMap properties(&IsEqualString);
241 HashMap elements(&IsEqualNumber); 241 ZoneHashMap elements(&IsEqualNumber);
242 for (int i = this->properties()->length() - 1; i >= 0; i--) { 242 for (int i = this->properties()->length() - 1; i >= 0; i--) {
243 ObjectLiteral::Property* property = this->properties()->at(i); 243 ObjectLiteral::Property* property = this->properties()->at(i);
244 Literal* literal = property->key(); 244 Literal* literal = property->key();
245 Handle<Object> handle = literal->handle(); 245 Handle<Object> handle = literal->handle();
246 246
247 if (handle->IsNull()) { 247 if (handle->IsNull()) {
248 continue; 248 continue;
249 } 249 }
250 250
251 uint32_t hash; 251 uint32_t hash;
252 HashMap* table; 252 ZoneHashMap* table;
253 void* key; 253 void* key;
254 Factory* factory = Isolate::Current()->factory(); 254 Factory* factory = Isolate::Current()->factory();
255 if (handle->IsSymbol()) { 255 if (handle->IsSymbol()) {
256 Handle<String> name(String::cast(*handle)); 256 Handle<String> name(String::cast(*handle));
257 if (name->AsArrayIndex(&hash)) { 257 if (name->AsArrayIndex(&hash)) {
258 Handle<Object> key_handle = factory->NewNumberFromUint(hash); 258 Handle<Object> key_handle = factory->NewNumberFromUint(hash);
259 key = key_handle.location(); 259 key = key_handle.location();
260 table = &elements; 260 table = &elements;
261 } else { 261 } else {
262 key = name.location(); 262 key = name.location();
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 (node->name()->IsEqualTo(CStrVector("_ArgumentsLength")) || 1131 (node->name()->IsEqualTo(CStrVector("_ArgumentsLength")) ||
1132 node->name()->IsEqualTo(CStrVector("_Arguments")))) { 1132 node->name()->IsEqualTo(CStrVector("_Arguments")))) {
1133 // Don't inline the %_ArgumentsLength or %_Arguments because their 1133 // Don't inline the %_ArgumentsLength or %_Arguments because their
1134 // implementation will not work. There is no stack frame to get them 1134 // implementation will not work. There is no stack frame to get them
1135 // from. 1135 // from.
1136 add_flag(kDontInline); 1136 add_flag(kDontInline);
1137 } 1137 }
1138 } 1138 }
1139 1139
1140 } } // namespace v8::internal 1140 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/SConscript ('k') | src/bootstrapper.cc » ('j') | src/isolate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698