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

Side by Side Diff: src/runtime.cc

Issue 261773006: Tighten up Object.observe code to ASSERT that it never deals with globals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | « src/objects.cc ('k') | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "v8.h" 8 #include "v8.h"
9 9
10 #include "accessors.h" 10 #include "accessors.h"
(...skipping 14865 matching lines...) Expand 10 before | Expand all | Expand 10 after
14876 return isolate->heap()->ToBoolean(obj->IsJSGlobalProxy()); 14876 return isolate->heap()->ToBoolean(obj->IsJSGlobalProxy());
14877 } 14877 }
14878 14878
14879 14879
14880 RUNTIME_FUNCTION(Runtime_IsObserved) { 14880 RUNTIME_FUNCTION(Runtime_IsObserved) {
14881 SealHandleScope shs(isolate); 14881 SealHandleScope shs(isolate);
14882 ASSERT(args.length() == 1); 14882 ASSERT(args.length() == 1);
14883 14883
14884 if (!args[0]->IsJSReceiver()) return isolate->heap()->false_value(); 14884 if (!args[0]->IsJSReceiver()) return isolate->heap()->false_value();
14885 CONVERT_ARG_CHECKED(JSReceiver, obj, 0); 14885 CONVERT_ARG_CHECKED(JSReceiver, obj, 0);
14886 if (obj->IsJSGlobalProxy()) { 14886 ASSERT(!obj->IsJSGlobalProxy() || !obj->map()->is_observed());
14887 Object* proto = obj->GetPrototype();
14888 if (proto->IsNull()) return isolate->heap()->false_value();
14889 ASSERT(proto->IsJSGlobalObject());
14890 obj = JSReceiver::cast(proto);
14891 }
14892 return isolate->heap()->ToBoolean(obj->map()->is_observed()); 14887 return isolate->heap()->ToBoolean(obj->map()->is_observed());
14893 } 14888 }
14894 14889
14895 14890
14896 RUNTIME_FUNCTION(Runtime_SetIsObserved) { 14891 RUNTIME_FUNCTION(Runtime_SetIsObserved) {
14897 HandleScope scope(isolate); 14892 HandleScope scope(isolate);
14898 ASSERT(args.length() == 1); 14893 ASSERT(args.length() == 1);
14899 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); 14894 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0);
14900 if (obj->IsJSGlobalProxy()) { 14895 ASSERT(!obj->IsJSGlobalProxy());
14901 Object* proto = obj->GetPrototype();
14902 if (proto->IsNull()) return isolate->heap()->undefined_value();
14903 ASSERT(proto->IsJSGlobalObject());
14904 obj = handle(JSReceiver::cast(proto));
14905 }
14906 if (obj->IsJSProxy()) 14896 if (obj->IsJSProxy())
14907 return isolate->heap()->undefined_value(); 14897 return isolate->heap()->undefined_value();
14908 14898
14909 ASSERT(obj->IsJSObject()); 14899 ASSERT(obj->IsJSObject());
14910 JSObject::SetObserved(Handle<JSObject>::cast(obj)); 14900 JSObject::SetObserved(Handle<JSObject>::cast(obj));
14911 return isolate->heap()->undefined_value(); 14901 return isolate->heap()->undefined_value();
14912 } 14902 }
14913 14903
14914 14904
14915 RUNTIME_FUNCTION(Runtime_SetMicrotaskPending) { 14905 RUNTIME_FUNCTION(Runtime_SetMicrotaskPending) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
15263 } 15253 }
15264 return NULL; 15254 return NULL;
15265 } 15255 }
15266 15256
15267 15257
15268 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15258 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15269 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15259 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15270 } 15260 }
15271 15261
15272 } } // namespace v8::internal 15262 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698