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

Side by Side Diff: src/accessors.cc

Issue 3522008: This is a little experiment to move Failure to a superclass above Object... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 2 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 | « no previous file | src/arm/stub-cache-arm.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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 434
435 // 435 //
436 // Accessors::FunctionPrototype 436 // Accessors::FunctionPrototype
437 // 437 //
438 438
439 439
440 Object* Accessors::FunctionGetPrototype(Object* object, void*) { 440 Object* Accessors::FunctionGetPrototype(Object* object, void*) {
441 bool found_it = false; 441 bool found_it = false;
442 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); 442 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it);
443 if (!found_it) return Heap::undefined_value(); 443 if (!found_it) return Heap::undefined_value();
444 Object* prototype;
445 { TryAllocation t = Heap::AllocateFunctionPrototype(function);
446 if (!t->ToObject(&prototype)) return t;
447 }
444 if (!function->has_prototype()) { 448 if (!function->has_prototype()) {
445 Object* prototype = Heap::AllocateFunctionPrototype(function); 449 Object* result;
446 if (prototype->IsFailure()) return prototype; 450 { TryAllocation t = function->SetPrototype(prototype);
447 Object* result = function->SetPrototype(prototype); 451 if (!t->ToObject(&result)) return t;
448 if (result->IsFailure()) return result; 452 }
449 } 453 }
450 return function->prototype(); 454 return function->prototype();
451 } 455 }
452 456
453 457
454 Object* Accessors::FunctionSetPrototype(JSObject* object, 458 Object* Accessors::FunctionSetPrototype(JSObject* object,
455 Object* value, 459 Object* value,
456 void*) { 460 void*) {
457 bool found_it = false; 461 bool found_it = false;
458 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); 462 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it);
459 if (!found_it) return Heap::undefined_value(); 463 if (!found_it) return Heap::undefined_value();
460 if (function->has_initial_map()) { 464 if (function->has_initial_map()) {
461 // If the function has allocated the initial map 465 // If the function has allocated the initial map
466 Object* new_map;
467 { TryAllocation t = function->initial_map()->CopyDropTransitions();
468 if (!t->ToObject(&new_map)) return t;
469 }
462 // replace it with a copy containing the new prototype. 470 // replace it with a copy containing the new prototype.
463 Object* new_map = function->initial_map()->CopyDropTransitions();
464 if (new_map->IsFailure()) return new_map;
465 function->set_initial_map(Map::cast(new_map)); 471 function->set_initial_map(Map::cast(new_map));
472 Object* prototype;
473 { TryAllocation t = function->SetPrototype(value);
474 if (!t->ToObject(&prototype)) return t;
466 } 475 }
467 Object* prototype = function->SetPrototype(value); 476 }
468 if (prototype->IsFailure()) return prototype;
469 ASSERT(function->prototype() == value); 477 ASSERT(function->prototype() == value);
470 return function; 478 return function;
471 } 479 }
472 480
473 481
474 const AccessorDescriptor Accessors::FunctionPrototype = { 482 const AccessorDescriptor Accessors::FunctionPrototype = {
475 FunctionGetPrototype, 483 FunctionGetPrototype,
476 FunctionSetPrototype, 484 FunctionSetPrototype,
477 0 485 0
478 }; 486 };
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 } 660 }
653 661
654 662
655 const AccessorDescriptor Accessors::ObjectPrototype = { 663 const AccessorDescriptor Accessors::ObjectPrototype = {
656 ObjectGetPrototype, 664 ObjectGetPrototype,
657 ObjectSetPrototype, 665 ObjectSetPrototype,
658 0 666 0
659 }; 667 };
660 668
661 } } // namespace v8::internal 669 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698