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

Side by Side Diff: src/runtime.cc

Issue 12929024: Fix global object check in %IsObserved and %SetIsObserved. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 12809 matching lines...) Expand 10 before | Expand all | Expand 10 after
12820 return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); 12820 return isolate->heap()->ToBoolean(obj1->map() == obj2->map());
12821 } 12821 }
12822 12822
12823 12823
12824 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsObserved) { 12824 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsObserved) {
12825 NoHandleAllocation ha(isolate); 12825 NoHandleAllocation ha(isolate);
12826 ASSERT(args.length() == 1); 12826 ASSERT(args.length() == 1);
12827 CONVERT_ARG_CHECKED(JSReceiver, obj, 0); 12827 CONVERT_ARG_CHECKED(JSReceiver, obj, 0);
12828 if (obj->IsJSGlobalProxy()) { 12828 if (obj->IsJSGlobalProxy()) {
12829 Object* proto = obj->GetPrototype(); 12829 Object* proto = obj->GetPrototype();
12830 if (obj->IsNull()) return isolate->heap()->false_value(); 12830 if (proto->IsNull()) return isolate->heap()->false_value();
12831 ASSERT(proto->IsJSGlobalObject()); 12831 ASSERT(proto->IsJSGlobalObject());
12832 obj = JSReceiver::cast(proto); 12832 obj = JSReceiver::cast(proto);
12833 } 12833 }
12834 return isolate->heap()->ToBoolean(obj->map()->is_observed()); 12834 return isolate->heap()->ToBoolean(obj->map()->is_observed());
12835 } 12835 }
12836 12836
12837 12837
12838 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetIsObserved) { 12838 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetIsObserved) {
12839 NoHandleAllocation ha(isolate); 12839 NoHandleAllocation ha(isolate);
12840 ASSERT(args.length() == 2); 12840 ASSERT(args.length() == 2);
12841 CONVERT_ARG_CHECKED(JSReceiver, obj, 0); 12841 CONVERT_ARG_CHECKED(JSReceiver, obj, 0);
12842 CONVERT_BOOLEAN_ARG_CHECKED(is_observed, 1); 12842 CONVERT_BOOLEAN_ARG_CHECKED(is_observed, 1);
12843 if (obj->IsJSGlobalProxy()) { 12843 if (obj->IsJSGlobalProxy()) {
12844 Object* proto = obj->GetPrototype(); 12844 Object* proto = obj->GetPrototype();
12845 if (obj->IsNull()) return isolate->heap()->undefined_value(); 12845 if (proto->IsNull()) return isolate->heap()->undefined_value();
12846 ASSERT(proto->IsJSGlobalObject()); 12846 ASSERT(proto->IsJSGlobalObject());
12847 obj = JSReceiver::cast(proto); 12847 obj = JSReceiver::cast(proto);
12848 } 12848 }
12849 ASSERT(!(obj->map()->is_observed() && obj->IsJSObject() && 12849 ASSERT(!(obj->map()->is_observed() && obj->IsJSObject() &&
12850 JSObject::cast(obj)->HasFastElements())); 12850 JSObject::cast(obj)->HasFastElements()));
12851 if (obj->map()->is_observed() != is_observed) { 12851 if (obj->map()->is_observed() != is_observed) {
12852 if (is_observed && obj->IsJSObject() && 12852 if (is_observed && obj->IsJSObject() &&
12853 !JSObject::cast(obj)->HasExternalArrayElements()) { 12853 !JSObject::cast(obj)->HasExternalArrayElements()) {
12854 // Go to dictionary mode, so that we don't skip map checks. 12854 // Go to dictionary mode, so that we don't skip map checks.
12855 MaybeObject* maybe = JSObject::cast(obj)->NormalizeElements(); 12855 MaybeObject* maybe = JSObject::cast(obj)->NormalizeElements();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
12986 // Handle last resort GC and make sure to allow future allocations 12986 // Handle last resort GC and make sure to allow future allocations
12987 // to grow the heap without causing GCs (if possible). 12987 // to grow the heap without causing GCs (if possible).
12988 isolate->counters()->gc_last_resort_from_js()->Increment(); 12988 isolate->counters()->gc_last_resort_from_js()->Increment();
12989 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 12989 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
12990 "Runtime::PerformGC"); 12990 "Runtime::PerformGC");
12991 } 12991 }
12992 } 12992 }
12993 12993
12994 12994
12995 } } // namespace v8::internal 12995 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698