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

Unified Diff: src/objects.cc

Issue 6691003: Strict mode poision pills. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 side-by-side diff with in-line comments
Download patch
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 6e47946d128fc7957383f571e3b80b446e697665..79fe6cd07afd4f5a91f1c128f9ecf6f6fa7a2c7f 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -5536,12 +5536,21 @@ MaybeObject* JSFunction::SetPrototype(Object* value) {
Object* JSFunction::RemovePrototype() {
- if (map() == context()->global_context()->function_without_prototype_map()) {
+ Map* no_prototype_map = shared()->strict_mode()
+ ? context()->global_context()->function_without_prototype_map_strict()
+ : context()->global_context()->function_without_prototype_map();
+
+ if (map() == no_prototype_map) {
// Be idempotent.
return this;
}
- ASSERT(map() == context()->global_context()->function_map());
- set_map(context()->global_context()->function_without_prototype_map());
+
+ ASSERT((shared()->strict_mode() &&
+ map() == context()->global_context()->function_map_strict()) ||
Lasse Reichstein 2011/03/14 12:20:15 Try splitting it into two asserts: ASSERT(!shared
Martin Maly 2011/03/14 16:39:26 Done.
+ (!shared()->strict_mode() &&
+ map() == context()->global_context()->function_map()));
+
+ set_map(no_prototype_map);
set_prototype_or_initial_map(Heap::the_hole_value());
return this;
}

Powered by Google App Engine
This is Rietveld 408576698