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

Side by Side Diff: src/objects.cc

Issue 2928: Propagate the information that a monomorphic prototype failure has... (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::FindInCodeCache(String* name, Code::Flags flags) { 2413 Object* Map::FindIndexInCodeCache(String* name, Code::Flags flags, int* index) {
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 return key; 2419 continue;
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) return code; 2423 if (code->flags() == flags) {
2424 *index = i + 1;
2425 return code;
2426 }
2424 } 2427 }
2425 } 2428 }
2429 *index = -1;
2426 return Heap::undefined_value(); 2430 return Heap::undefined_value();
2427 } 2431 }
2428 2432
2429 2433
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
2448 void FixedArray::FixedArrayIterateBody(ObjectVisitor* v) { 2434 void FixedArray::FixedArrayIterateBody(ObjectVisitor* v) {
2449 IteratePointers(v, kHeaderSize, kHeaderSize + length() * kPointerSize); 2435 IteratePointers(v, kHeaderSize, kHeaderSize + length() * kPointerSize);
2450 } 2436 }
2451 2437
2452 2438
2453 static bool HasKey(FixedArray* array, Object* key) { 2439 static bool HasKey(FixedArray* array, Object* key) {
2454 int len0 = array->length(); 2440 int len0 = array->length();
2455 for (int i = 0; i < len0; i++) { 2441 for (int i = 0; i < len0; i++) {
2456 Object* element = array->get(i); 2442 Object* element = array->get(i);
2457 if (element->IsSmi() && key->IsSmi() && (element == key)) return true; 2443 if (element->IsSmi() && key->IsSmi() && (element == key)) return true;
(...skipping 3805 matching lines...) Expand 10 before | Expand all | Expand 10 after
6263 // No break point. 6249 // No break point.
6264 if (break_point_objects()->IsUndefined()) return 0; 6250 if (break_point_objects()->IsUndefined()) return 0;
6265 // Single beak point. 6251 // Single beak point.
6266 if (!break_point_objects()->IsFixedArray()) return 1; 6252 if (!break_point_objects()->IsFixedArray()) return 1;
6267 // Multiple break points. 6253 // Multiple break points.
6268 return FixedArray::cast(break_point_objects())->length(); 6254 return FixedArray::cast(break_point_objects())->length();
6269 } 6255 }
6270 6256
6271 6257
6272 } } // namespace v8::internal 6258 } } // 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