| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include <stdlib.h> | 28 #include <stdlib.h> |
| 29 | 29 |
| 30 // TODO(dcarney): remove |
| 31 #define V8_ALLOW_ACCESS_TO_PERSISTENT_ARROW |
| 32 #define V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR |
| 33 #define V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT |
| 34 |
| 30 #include "v8.h" | 35 #include "v8.h" |
| 31 | 36 |
| 32 #include "heap.h" | 37 #include "heap.h" |
| 33 #include "cctest.h" | 38 #include "cctest.h" |
| 34 | 39 |
| 35 using namespace v8; | 40 using namespace v8; |
| 36 | 41 |
| 37 | 42 |
| 38 enum Expectations { | 43 enum Expectations { |
| 39 EXPECT_RESULT, | 44 EXPECT_RESULT, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 Local<FunctionTemplate> function = FunctionTemplate::New(); | 122 Local<FunctionTemplate> function = FunctionTemplate::New(); |
| 118 Local<Value> data = External::New(this); | 123 Local<Value> data = External::New(this); |
| 119 GetHolder(function)->SetNamedPropertyHandler(&HandleGet, | 124 GetHolder(function)->SetNamedPropertyHandler(&HandleGet, |
| 120 &HandleSet, | 125 &HandleSet, |
| 121 &HandleQuery, | 126 &HandleQuery, |
| 122 0, 0, | 127 0, 0, |
| 123 data); | 128 data); |
| 124 context_ = Context::New(0, function->InstanceTemplate(), Local<Value>()); | 129 context_ = Context::New(0, function->InstanceTemplate(), Local<Value>()); |
| 125 context_->Enter(); | 130 context_->Enter(); |
| 126 is_initialized_ = true; | 131 is_initialized_ = true; |
| 127 PostInitializeContext(context_); | 132 PostInitializeContext(Local<Context>::New(Isolate::GetCurrent(), context_)); |
| 128 } | 133 } |
| 129 | 134 |
| 130 | 135 |
| 131 void DeclarationContext::Check(const char* source, | 136 void DeclarationContext::Check(const char* source, |
| 132 int get, int set, int query, | 137 int get, int set, int query, |
| 133 Expectations expectations, | 138 Expectations expectations, |
| 134 v8::Handle<Value> value) { | 139 v8::Handle<Value> value) { |
| 135 InitializeIfNeeded(); | 140 InitializeIfNeeded(); |
| 136 // A retry after a GC may pollute the counts, so perform gc now | 141 // A retry after a GC may pollute the counts, so perform gc now |
| 137 // to avoid that. | 142 // to avoid that. |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 SimpleContext context; | 839 SimpleContext context; |
| 835 context.Check(firsts[i], EXPECT_RESULT, Number::New(1)); | 840 context.Check(firsts[i], EXPECT_RESULT, Number::New(1)); |
| 836 // TODO(rossberg): All tests should actually be errors in Harmony, | 841 // TODO(rossberg): All tests should actually be errors in Harmony, |
| 837 // but we currently do not detect the cases where the first declaration | 842 // but we currently do not detect the cases where the first declaration |
| 838 // is not lexical. | 843 // is not lexical. |
| 839 context.Check(seconds[j], | 844 context.Check(seconds[j], |
| 840 i < 2 ? EXPECT_RESULT : EXPECT_ERROR, Number::New(2)); | 845 i < 2 ? EXPECT_RESULT : EXPECT_ERROR, Number::New(2)); |
| 841 } | 846 } |
| 842 } | 847 } |
| 843 } | 848 } |
| OLD | NEW |