| 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 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 DeclarationContext::DeclarationContext() | 111 DeclarationContext::DeclarationContext() |
| 112 : is_initialized_(false), get_count_(0), set_count_(0), query_count_(0) { | 112 : is_initialized_(false), get_count_(0), set_count_(0), query_count_(0) { |
| 113 // Do nothing. | 113 // Do nothing. |
| 114 } | 114 } |
| 115 | 115 |
| 116 | 116 |
| 117 void DeclarationContext::InitializeIfNeeded() { | 117 void DeclarationContext::InitializeIfNeeded() { |
| 118 if (is_initialized_) return; | 118 if (is_initialized_) return; |
| 119 Isolate* isolate = CcTest::isolate(); | 119 Isolate* isolate = CcTest::isolate(); |
| 120 HandleScope scope(isolate); | 120 HandleScope scope(isolate); |
| 121 Local<FunctionTemplate> function = FunctionTemplate::New(); | 121 Local<FunctionTemplate> function = FunctionTemplate::New(isolate); |
| 122 Local<Value> data = External::New(CcTest::isolate(), this); | 122 Local<Value> data = External::New(CcTest::isolate(), this); |
| 123 GetHolder(function)->SetNamedPropertyHandler(&HandleGet, | 123 GetHolder(function)->SetNamedPropertyHandler(&HandleGet, |
| 124 &HandleSet, | 124 &HandleSet, |
| 125 &HandleQuery, | 125 &HandleQuery, |
| 126 0, 0, | 126 0, 0, |
| 127 data); | 127 data); |
| 128 Local<Context> context = Context::New(isolate, | 128 Local<Context> context = Context::New(isolate, |
| 129 0, | 129 0, |
| 130 function->InstanceTemplate(), | 130 function->InstanceTemplate(), |
| 131 Local<Value>()); | 131 Local<Value>()); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 0, | 627 0, |
| 628 EXPECT_RESULT, Undefined(CcTest::isolate())); | 628 EXPECT_RESULT, Undefined(CcTest::isolate())); |
| 629 } | 629 } |
| 630 } | 630 } |
| 631 | 631 |
| 632 | 632 |
| 633 | 633 |
| 634 class ExistsInHiddenPrototypeContext: public DeclarationContext { | 634 class ExistsInHiddenPrototypeContext: public DeclarationContext { |
| 635 public: | 635 public: |
| 636 ExistsInHiddenPrototypeContext() { | 636 ExistsInHiddenPrototypeContext() { |
| 637 hidden_proto_ = FunctionTemplate::New(); | 637 hidden_proto_ = FunctionTemplate::New(CcTest::isolate()); |
| 638 hidden_proto_->SetHiddenPrototype(true); | 638 hidden_proto_->SetHiddenPrototype(true); |
| 639 } | 639 } |
| 640 | 640 |
| 641 protected: | 641 protected: |
| 642 virtual v8::Handle<Integer> Query(Local<String> key) { | 642 virtual v8::Handle<Integer> Query(Local<String> key) { |
| 643 // Let it seem that the property exists in the hidden prototype object. | 643 // Let it seem that the property exists in the hidden prototype object. |
| 644 return Integer::New(v8::None); | 644 return Integer::New(v8::None); |
| 645 } | 645 } |
| 646 | 646 |
| 647 // Install the hidden prototype after the global object has been created. | 647 // Install the hidden prototype after the global object has been created. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 SimpleContext context; | 856 SimpleContext context; |
| 857 context.Check(firsts[i], EXPECT_RESULT, Number::New(1)); | 857 context.Check(firsts[i], EXPECT_RESULT, Number::New(1)); |
| 858 // TODO(rossberg): All tests should actually be errors in Harmony, | 858 // TODO(rossberg): All tests should actually be errors in Harmony, |
| 859 // but we currently do not detect the cases where the first declaration | 859 // but we currently do not detect the cases where the first declaration |
| 860 // is not lexical. | 860 // is not lexical. |
| 861 context.Check(seconds[j], | 861 context.Check(seconds[j], |
| 862 i < 2 ? EXPECT_RESULT : EXPECT_ERROR, Number::New(2)); | 862 i < 2 ? EXPECT_RESULT : EXPECT_ERROR, Number::New(2)); |
| 863 } | 863 } |
| 864 } | 864 } |
| 865 } | 865 } |
| OLD | NEW |