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

Side by Side Diff: src/accessors.cc

Issue 6518003: Do not allow calls to SetProtoType on functions that should not have a protot... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-1151.js » ('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 // Accessors::FunctionPrototype 441 // Accessors::FunctionPrototype
442 // 442 //
443 443
444 444
445 MaybeObject* Accessors::FunctionGetPrototype(Object* object, void*) { 445 MaybeObject* Accessors::FunctionGetPrototype(Object* object, void*) {
446 bool found_it = false; 446 bool found_it = false;
447 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it); 447 JSFunction* function = FindInPrototypeChain<JSFunction>(object, &found_it);
448 if (!found_it) return Heap::undefined_value(); 448 if (!found_it) return Heap::undefined_value();
449 if (!function->has_prototype()) { 449 if (!function->has_prototype()) {
450 if (!function->should_have_prototype()) return Heap::undefined_value();
450 Object* prototype; 451 Object* prototype;
451 { MaybeObject* maybe_prototype = Heap::AllocateFunctionPrototype(function); 452 { MaybeObject* maybe_prototype = Heap::AllocateFunctionPrototype(function);
452 if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype; 453 if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype;
453 } 454 }
454 Object* result; 455 Object* result;
455 { MaybeObject* maybe_result = function->SetPrototype(prototype); 456 { MaybeObject* maybe_result = function->SetPrototype(prototype);
456 if (!maybe_result->ToObject(&result)) return maybe_result; 457 if (!maybe_result->ToObject(&result)) return maybe_result;
457 } 458 }
458 } 459 }
459 return function->prototype(); 460 return function->prototype();
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 } 884 }
884 885
885 886
886 const AccessorDescriptor Accessors::ObjectPrototype = { 887 const AccessorDescriptor Accessors::ObjectPrototype = {
887 ObjectGetPrototype, 888 ObjectGetPrototype,
888 ObjectSetPrototype, 889 ObjectSetPrototype,
889 0 890 0
890 }; 891 };
891 892
892 } } // namespace v8::internal 893 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-1151.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698