OLD | NEW |
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 7778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7789 | 7789 |
7790 int y() { return y_; } | 7790 int y() { return y_; } |
7791 void set_y(int y) { y_ = y; } | 7791 void set_y(int y) { y_ = y; } |
7792 | 7792 |
7793 private: | 7793 private: |
7794 int y_; | 7794 int y_; |
7795 int x_; | 7795 int x_; |
7796 }; | 7796 }; |
7797 | 7797 |
7798 | 7798 |
7799 void CheckInternalFields( | 7799 void CheckInternalFields(const v8::PhantomCallbackData< |
7800 const v8::InternalFieldsCallbackData<Trivial, Trivial2>& data) { | 7800 v8::Persistent<v8::Object>, Trivial, Trivial2>& data) { |
| 7801 v8::Persistent<v8::Object>* handle = data.GetParameter(); |
| 7802 handle->Reset(); |
7801 Trivial* t1 = data.GetInternalField1(); | 7803 Trivial* t1 = data.GetInternalField1(); |
7802 Trivial2* t2 = data.GetInternalField2(); | 7804 Trivial2* t2 = data.GetInternalField2(); |
7803 CHECK_EQ(42, t1->x()); | 7805 CHECK_EQ(42, t1->x()); |
7804 CHECK_EQ(103, t2->x()); | 7806 CHECK_EQ(103, t2->x()); |
7805 t1->set_x(1729); | 7807 t1->set_x(1729); |
7806 t2->set_x(33550336); | 7808 t2->set_x(33550336); |
7807 } | 7809 } |
7808 | 7810 |
7809 | 7811 |
7810 void InternalFieldCallback(bool global_gc) { | 7812 void InternalFieldCallback(bool global_gc) { |
(...skipping 17 matching lines...) Expand all Loading... |
7828 | 7830 |
7829 obj->SetAlignedPointerInInternalField(0, t1); | 7831 obj->SetAlignedPointerInInternalField(0, t1); |
7830 t1 = reinterpret_cast<Trivial*>(obj->GetAlignedPointerFromInternalField(0)); | 7832 t1 = reinterpret_cast<Trivial*>(obj->GetAlignedPointerFromInternalField(0)); |
7831 CHECK_EQ(42, t1->x()); | 7833 CHECK_EQ(42, t1->x()); |
7832 | 7834 |
7833 obj->SetAlignedPointerInInternalField(1, t2); | 7835 obj->SetAlignedPointerInInternalField(1, t2); |
7834 t2 = | 7836 t2 = |
7835 reinterpret_cast<Trivial2*>(obj->GetAlignedPointerFromInternalField(1)); | 7837 reinterpret_cast<Trivial2*>(obj->GetAlignedPointerFromInternalField(1)); |
7836 CHECK_EQ(103, t2->x()); | 7838 CHECK_EQ(103, t2->x()); |
7837 | 7839 |
7838 handle.SetPhantom(CheckInternalFields, 0, 1); | 7840 handle.SetPhantom<v8::Persistent<v8::Object>, Trivial, Trivial2>( |
| 7841 &handle, 0, 1, CheckInternalFields); |
7839 if (!global_gc) { | 7842 if (!global_gc) { |
7840 handle.MarkIndependent(); | 7843 handle.MarkIndependent(); |
7841 } | 7844 } |
7842 } | 7845 } |
7843 if (global_gc) { | 7846 if (global_gc) { |
7844 CcTest::heap()->CollectAllGarbage(TestHeap::Heap::kNoGCFlags); | 7847 CcTest::heap()->CollectAllGarbage(TestHeap::Heap::kNoGCFlags); |
7845 } else { | 7848 } else { |
7846 CcTest::heap()->CollectGarbage(i::NEW_SPACE); | 7849 CcTest::heap()->CollectGarbage(i::NEW_SPACE); |
7847 } | 7850 } |
7848 | 7851 |
(...skipping 16903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24752 "bar2.js"); | 24755 "bar2.js"); |
24753 } | 24756 } |
24754 | 24757 |
24755 | 24758 |
24756 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { | 24759 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { |
24757 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", | 24760 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", |
24758 " sourceMappingURL=bar2.js\n", "foo();", NULL}; | 24761 " sourceMappingURL=bar2.js\n", "foo();", NULL}; |
24759 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, | 24762 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, |
24760 "bar2.js"); | 24763 "bar2.js"); |
24761 } | 24764 } |
OLD | NEW |