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

Unified Diff: src/objects.cc

Issue 255333004: Harden more runtime functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 6 years, 8 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
« no previous file with comments | « src/objects.h ('k') | src/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index b411ec607ba19f07631fe56f53c46fd7bd525f7f..1daf1ebc0297df1a7e89257ed80d2a2d853841c8 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -10213,20 +10213,25 @@ void JSFunction::SetPrototype(Handle<JSFunction> function,
}
-void JSFunction::RemovePrototype() {
+bool JSFunction::RemovePrototype() {
Context* native_context = context()->native_context();
Map* no_prototype_map = shared()->strict_mode() == SLOPPY
? native_context->sloppy_function_without_prototype_map()
: native_context->strict_function_without_prototype_map();
- if (map() == no_prototype_map) return;
+ if (map() == no_prototype_map) return true;
- ASSERT(map() == (shared()->strict_mode() == SLOPPY
+#ifdef DEBUG
+ if (map() != (shared()->strict_mode() == SLOPPY
? native_context->sloppy_function_map()
- : native_context->strict_function_map()));
+ : native_context->strict_function_map())) {
+ return false;
+ }
+#endif
set_map(no_prototype_map);
set_prototype_or_initial_map(no_prototype_map->GetHeap()->the_hole_value());
+ return true;
}
« no previous file with comments | « src/objects.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698