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

Side by Side Diff: src/accessors.cc

Issue 6614010: [Isolates] Merge 6700:7030 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 9 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/SConscript ('k') | src/api.cc » ('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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 440
441 // 441 //
442 // Accessors::FunctionPrototype 442 // Accessors::FunctionPrototype
443 // 443 //
444 444
445 445
446 MaybeObject* Accessors::FunctionGetPrototype(Object* object, void*) { 446 MaybeObject* Accessors::FunctionGetPrototype(Object* object, void*) {
447 bool found_it = false; 447 bool found_it = false;
448 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); 448 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it);
449 if (!found_it) return HEAP->undefined_value(); 449 if (!found_it) return HEAP->undefined_value();
450 while (!function->should_have_prototype()) {
451 found_it = false;
452 function = FindInPrototypeChain<JSFunction>(object->GetPrototype(),
453 &found_it);
454 // There has to be one because we hit the getter.
455 ASSERT(found_it);
456 }
457
450 if (!function->has_prototype()) { 458 if (!function->has_prototype()) {
451 Object* prototype; 459 Object* prototype;
452 { MaybeObject* maybe_prototype = HEAP->AllocateFunctionPrototype(function); 460 { MaybeObject* maybe_prototype = HEAP->AllocateFunctionPrototype(function);
453 if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype; 461 if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype;
454 } 462 }
455 Object* result; 463 Object* result;
456 { MaybeObject* maybe_result = function->SetPrototype(prototype); 464 { MaybeObject* maybe_result = function->SetPrototype(prototype);
457 if (!maybe_result->ToObject(&result)) return maybe_result; 465 if (!maybe_result->ToObject(&result)) return maybe_result;
458 } 466 }
459 } 467 }
460 return function->prototype(); 468 return function->prototype();
461 } 469 }
462 470
463 471
464 MaybeObject* Accessors::FunctionSetPrototype(JSObject* object, 472 MaybeObject* Accessors::FunctionSetPrototype(JSObject* object,
465 Object* value, 473 Object* value,
466 void*) { 474 void*) {
467 bool found_it = false; 475 bool found_it = false;
468 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); 476 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it);
469 if (!found_it) return HEAP->undefined_value(); 477 if (!found_it) return HEAP->undefined_value();
478 if (!function->should_have_prototype()) {
479 // Since we hit this accessor, object will have no prototype property.
480 return object->SetLocalPropertyIgnoreAttributes(HEAP->prototype_symbol(),
481 value,
482 NONE);
483 }
484
470 if (function->has_initial_map()) { 485 if (function->has_initial_map()) {
471 // If the function has allocated the initial map 486 // If the function has allocated the initial map
472 // replace it with a copy containing the new prototype. 487 // replace it with a copy containing the new prototype.
473 Object* new_map; 488 Object* new_map;
474 { MaybeObject* maybe_new_map = 489 { MaybeObject* maybe_new_map =
475 function->initial_map()->CopyDropTransitions(); 490 function->initial_map()->CopyDropTransitions();
476 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; 491 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map;
477 } 492 }
478 function->set_initial_map(Map::cast(new_map)); 493 function->set_initial_map(Map::cast(new_map));
479 } 494 }
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 } 902 }
888 903
889 904
890 const AccessorDescriptor Accessors::ObjectPrototype = { 905 const AccessorDescriptor Accessors::ObjectPrototype = {
891 ObjectGetPrototype, 906 ObjectGetPrototype,
892 ObjectSetPrototype, 907 ObjectSetPrototype,
893 0 908 0
894 }; 909 };
895 910
896 } } // namespace v8::internal 911 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/SConscript ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698