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

Side by Side Diff: src/objects.cc

Issue 2959: Revert revision 331. The propagation of monomorphic prototype failure... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 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/objects.h ('k') | src/objects-inl.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 2392 matching lines...) Expand 10 before | Expand all | Expand 10 after
2403 2403
2404 // Add the (name, code) pair to the new cache. 2404 // Add the (name, code) pair to the new cache.
2405 cache = FixedArray::cast(result); 2405 cache = FixedArray::cast(result);
2406 cache->set(length + 0, name); 2406 cache->set(length + 0, name);
2407 cache->set(length + 1, code); 2407 cache->set(length + 1, code);
2408 set_code_cache(cache); 2408 set_code_cache(cache);
2409 return this; 2409 return this;
2410 } 2410 }
2411 2411
2412 2412
2413 Object* Map::FindIndexInCodeCache(String* name, Code::Flags flags, int* index) { 2413 Object* Map::FindInCodeCache(String* name, Code::Flags flags) {
2414 FixedArray* cache = code_cache(); 2414 FixedArray* cache = code_cache();
2415 int length = cache->length(); 2415 int length = cache->length();
2416 for (int i = 0; i < length; i += 2) { 2416 for (int i = 0; i < length; i += 2) {
2417 Object* key = cache->get(i); 2417 Object* key = cache->get(i);
2418 if (key->IsUndefined()) { 2418 if (key->IsUndefined()) {
2419 continue; 2419 return key;
2420 } 2420 }
2421 if (name->Equals(String::cast(key))) { 2421 if (name->Equals(String::cast(key))) {
2422 Code* code = Code::cast(cache->get(i + 1)); 2422 Code* code = Code::cast(cache->get(i + 1));
2423 if (code->flags() == flags) { 2423 if (code->flags() == flags) return code;
2424 *index = i + 1;
2425 return code;
2426 }
2427 } 2424 }
2428 } 2425 }
2429 *index = -1;
2430 return Heap::undefined_value(); 2426 return Heap::undefined_value();
2431 } 2427 }
2432 2428
2433 2429
2430 int Map::IndexInCodeCache(Code* code) {
2431 FixedArray* array = code_cache();
2432 int len = array->length();
2433 for (int i = 0; i < len; i += 2) {
2434 if (array->get(i + 1) == code) return i + 1;
2435 }
2436 return -1;
2437 }
2438
2439
2440 void Map::RemoveFromCodeCache(int index) {
2441 FixedArray* array = code_cache();
2442 ASSERT(array->length() >= index && array->get(index)->IsCode());
2443 array->set_undefined(index - 1); // key
2444 array->set_undefined(index); // code
2445 }
2446
2447
2434 void FixedArray::FixedArrayIterateBody(ObjectVisitor* v) { 2448 void FixedArray::FixedArrayIterateBody(ObjectVisitor* v) {
2435 IteratePointers(v, kHeaderSize, kHeaderSize + length() * kPointerSize); 2449 IteratePointers(v, kHeaderSize, kHeaderSize + length() * kPointerSize);
2436 } 2450 }
2437 2451
2438 2452
2439 static bool HasKey(FixedArray* array, Object* key) { 2453 static bool HasKey(FixedArray* array, Object* key) {
2440 int len0 = array->length(); 2454 int len0 = array->length();
2441 for (int i = 0; i < len0; i++) { 2455 for (int i = 0; i < len0; i++) {
2442 Object* element = array->get(i); 2456 Object* element = array->get(i);
2443 if (element->IsSmi() && key->IsSmi() && (element == key)) return true; 2457 if (element->IsSmi() && key->IsSmi() && (element == key)) return true;
(...skipping 3820 matching lines...) Expand 10 before | Expand all | Expand 10 after
6264 // No break point. 6278 // No break point.
6265 if (break_point_objects()->IsUndefined()) return 0; 6279 if (break_point_objects()->IsUndefined()) return 0;
6266 // Single beak point. 6280 // Single beak point.
6267 if (!break_point_objects()->IsFixedArray()) return 1; 6281 if (!break_point_objects()->IsFixedArray()) return 1;
6268 // Multiple break points. 6282 // Multiple break points.
6269 return FixedArray::cast(break_point_objects())->length(); 6283 return FixedArray::cast(break_point_objects())->length();
6270 } 6284 }
6271 6285
6272 6286
6273 } } // namespace v8::internal 6287 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698