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({})"); |