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

Side by Side Diff: src/runtime.cc

Issue 11802003: Add API for access checks on observed objects (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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/runtime.h ('k') | test/cctest/test-object-observe.cc » ('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 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 13523 matching lines...) Expand 10 before | Expand all | Expand 10 after
13534 Handle<Object> key = args.at<Object>(1); 13534 Handle<Object> key = args.at<Object>(1);
13535 if (key->IsJSGlobalProxy()) { 13535 if (key->IsJSGlobalProxy()) {
13536 key = handle(key->GetPrototype(), isolate); 13536 key = handle(key->GetPrototype(), isolate);
13537 if (key->IsNull()) return *table; 13537 if (key->IsNull()) return *table;
13538 } 13538 }
13539 Handle<Object> value = args.at<Object>(2); 13539 Handle<Object> value = args.at<Object>(2);
13540 return *PutIntoObjectHashTable(table, key, value); 13540 return *PutIntoObjectHashTable(table, key, value);
13541 } 13541 }
13542 13542
13543 13543
13544 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectObserveAllowed) {
13545 ASSERT(args.length() == 1);
13546 CONVERT_ARG_CHECKED(JSReceiver, receiver, 0);
13547 // Proxies aren't currently allowed to have access checks enabled
13548 if (receiver->IsJSProxy()) return isolate->heap()->true_value();
13549 JSObject* object = JSObject::cast(receiver);
13550 if (object->IsJSGlobalProxy()) {
13551 Object* proto = object->GetPrototype();
13552 if (proto->IsNull()) return isolate->heap()->false_value();
13553 ASSERT(proto->IsJSGlobalObject());
13554 object = JSObject::cast(proto);
13555 }
13556 if (!object->IsAccessCheckNeeded()) return isolate->heap()->true_value();
13557 return isolate->heap()->ToBoolean(isolate->MayObserveAccess(object));
13558 }
13559
13560
13544 // ---------------------------------------------------------------------------- 13561 // ----------------------------------------------------------------------------
13545 // Implementation of Runtime 13562 // Implementation of Runtime
13546 13563
13547 #define F(name, number_of_args, result_size) \ 13564 #define F(name, number_of_args, result_size) \
13548 { Runtime::k##name, Runtime::RUNTIME, #name, \ 13565 { Runtime::k##name, Runtime::RUNTIME, #name, \
13549 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, 13566 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size },
13550 13567
13551 13568
13552 #define I(name, number_of_args, result_size) \ 13569 #define I(name, number_of_args, result_size) \
13553 { Runtime::kInline##name, Runtime::INLINE, \ 13570 { Runtime::kInline##name, Runtime::INLINE, \
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
13620 // Handle last resort GC and make sure to allow future allocations 13637 // Handle last resort GC and make sure to allow future allocations
13621 // to grow the heap without causing GCs (if possible). 13638 // to grow the heap without causing GCs (if possible).
13622 isolate->counters()->gc_last_resort_from_js()->Increment(); 13639 isolate->counters()->gc_last_resort_from_js()->Increment();
13623 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13640 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13624 "Runtime::PerformGC"); 13641 "Runtime::PerformGC");
13625 } 13642 }
13626 } 13643 }
13627 13644
13628 13645
13629 } } // namespace v8::internal 13646 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/cctest/test-object-observe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698