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

Unified Diff: test/mjsunit/proto-poison.js

Issue 13533004: Make __proto__ a real JavaScript accessor property. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed moar comments by Andreas Rossberg. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/v8natives.js ('k') | test/mjsunit/regress/regress-2606.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/proto-poison.js
diff --git a/src/marking-thread.h b/test/mjsunit/proto-poison.js
similarity index 62%
copy from src/marking-thread.h
copy to test/mjsunit/proto-poison.js
index 9efa3af13262165972abf179defac6f83fed4ac9..ca3b5d6d061a21819a6b000fee84397231ad307f 100644
--- a/src/marking-thread.h
+++ b/test/mjsunit/proto-poison.js
@@ -25,47 +25,21 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef V8_MARKING_THREAD_H_
-#define V8_MARKING_THREAD_H_
-
-#include "atomicops.h"
-#include "flags.h"
-#include "platform.h"
-#include "v8utils.h"
-
-#include "spaces.h"
-
-#include "heap.h"
-
-namespace v8 {
-namespace internal {
-
-class MarkingThread : public Thread {
- public:
- explicit MarkingThread(Isolate* isolate);
-
- void Run();
- void Stop();
- void StartMarking();
- void WaitForMarkingThread();
-
- ~MarkingThread() {
- delete start_marking_semaphore_;
- delete end_marking_semaphore_;
- delete stop_semaphore_;
- }
-
- private:
- Isolate* isolate_;
- Heap* heap_;
- Semaphore* start_marking_semaphore_;
- Semaphore* end_marking_semaphore_;
- Semaphore* stop_semaphore_;
- volatile AtomicWord stop_thread_;
- int id_;
- static Atomic32 id_counter_;
-};
-
-} } // namespace v8::internal
-
-#endif // V8_MARKING_THREAD_H_
+// Check that the __proto__ accessor is properly poisoned when extracted
+// from Object.prototype using the property descriptor.
+var desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
+assertEquals("function", typeof desc.get);
+assertEquals("function", typeof desc.set);
+assertDoesNotThrow("desc.get.call({})");
+assertThrows("desc.set.call({})", TypeError);
+
+// Check that any redefinition of the __proto__ accessor causes poising
+// to cease and the accessor to be extracted normally.
+Object.defineProperty(Object.prototype, "__proto__", { get:function(){} });
+desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
+assertDoesNotThrow("desc.get.call({})");
+assertThrows("desc.set.call({})", TypeError);
+Object.defineProperty(Object.prototype, "__proto__", { set:function(x){} });
+desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
+assertDoesNotThrow("desc.get.call({})");
+assertDoesNotThrow("desc.set.call({})");
« no previous file with comments | « src/v8natives.js ('k') | test/mjsunit/regress/regress-2606.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698