54 if (is_initialized_) {
60 void Check(
const char* source,
61 int get,
int set,
int has,
74 void InitializeIfNeeded();
83 return function->InstanceTemplate();
109 : is_initialized_(
false), get_count_(0), set_count_(0), query_count_(0) {
115 if (is_initialized_)
return;
124 context_ = Context::New(0, function->InstanceTemplate(),
Local<Value>());
126 is_initialized_ =
true;
132 int get,
int set,
int query,
170 context->get_count_++;
171 return context->
Get(key);
179 context->set_count_++;
180 return context->
Set(key, value);
187 context->query_count_++;
188 return context->
Query(key);
219 context.
Check(
"var x; x",
227 context.
Check(
"var x = 0; x",
235 context.
Check(
"function x() { }; x",
243 context.
Check(
"const x; x",
251 context.
Check(
"const x = 0; x",
274 context.
Check(
"var x; x",
282 context.
Check(
"var x = 0; x",
290 context.
Check(
"function x() { }; x",
298 context.
Check(
"const x; x",
306 context.
Check(
"const x = 0; x",
328 context.
Check(
"var x; x",
336 context.
Check(
"var x = 0; x",
344 context.
Check(
"function x() { }; x",
352 context.
Check(
"const x; x",
360 context.
Check(
"const x = 0; x",
368 context.
Check(
"if (false) { var x = 0 }; x",
418 context.
Check(
"var x; x",
426 context.
Check(
"var x = 0; x",
434 context.
Check(
"function x() { }; x",
442 context.
Check(
"const x; x",
450 context.
Check(
"const x = 0; x",
510 context.
Check(
"const x; var x = 0",
529 return function->PrototypeTemplate();
535 i::FLAG_es52_globals =
true;
541 context.
Check(
"this.x = 87; this.x",
549 context.
Check(
"var x; x",
557 context.
Check(
"var x = 0; x",
565 context.
Check(
"const x; x",
573 context.
Check(
"const x = 0; x",
592 return function->PrototypeTemplate();
598 i::FLAG_es52_globals =
true;
602 context.
Check(
"if (false) { var x = 0; }; x",
615 hidden_proto_ = FunctionTemplate::New();
616 hidden_proto_->SetHiddenPrototype(
true);
628 Local<Object> hidden_proto = hidden_proto_->GetFunction()->NewInstance();
630 context->
Global()->SetPrototype(hidden_proto);
636 return hidden_proto_->InstanceTemplate();
644 TEST(ExistsInHiddenPrototype) {
645 i::FLAG_es52_globals =
true;
649 context.
Check(
"var x; x",
657 context.
Check(
"var x = 0; x",
665 context.
Check(
"function x() { }; x",
674 context.
Check(
"const x; x",
683 context.
Check(
"const x = 0; x",
696 context_ = Context::New(0);
720 if (!value.IsEmpty()) {
726 if (!value.IsEmpty()) {
741 context.
Check(
"var x = 1; x",
743 context.
Check(
"var x = 2; x",
745 context.
Check(
"const x = 3; x",
747 context.
Check(
"const x = 4; x",
749 context.
Check(
"x = 5; x",
751 context.
Check(
"var x = 6; x",
753 context.
Check(
"this.x",
755 context.
Check(
"function x() { return 7 }; x()",
760 context.
Check(
"const x = 1; x",
762 context.
Check(
"var x = 2; x",
764 context.
Check(
"const x = 3; x",
766 context.
Check(
"x = 4; x",
768 context.
Check(
"var x = 5; x",
770 context.
Check(
"this.x",
772 context.
Check(
"function x() { return 7 }; x",
776 i::FLAG_use_strict =
true;
777 i::FLAG_harmony_scoping =
true;
780 context.
Check(
"var x = 1; x",
784 context.
Check(
"this.x",
789 context.
Check(
"function x() { return 4 }; x()",
793 context.
Check(
"this.x()",
798 context.
Check(
"let x = 2; x",
810 context.
Check(
"const x = 3; x",
824 context.
Check(
"var x = 1; x",
826 context.
Check(
"let x = 2; x",
831 context.
Check(
"var x = 1; x",
833 context.
Check(
"const x = 2; x",
838 context.
Check(
"function x() { return 1 }; x()",
840 context.
Check(
"let x = 2; x",
845 context.
Check(
"function x() { return 1 }; x()",
847 context.
Check(
"const x = 2; x",
852 context.
Check(
"let x = 1; x",
854 context.
Check(
"var x = 2; x",
859 context.
Check(
"let x = 1; x",
861 context.
Check(
"let x = 2; x",
866 context.
Check(
"let x = 1; x",
868 context.
Check(
"const x = 2; x",
873 context.
Check(
"let x = 1; x",
875 context.
Check(
"function x() { return 2 }; x()",
880 context.
Check(
"const x = 1; x",
882 context.
Check(
"var x = 2; x",
887 context.
Check(
"const x = 1; x",
889 context.
Check(
"let x = 2; x",
894 context.
Check(
"const x = 1; x",
896 context.
Check(
"const x = 2; x",
901 context.
Check(
"const x = 1; x",
903 context.
Check(
"function x() { return 2 }; x()",
ExistsInHiddenPrototypeContext()
#define CHECK_EQ(expected, value)
static v8::Handle< Value > HandleGet(Local< String > key, const AccessorInfo &info)
Local< Value > Exception() const
void InitializeIfNeeded()
virtual v8::Handle< Integer > Query(Local< String > key)
virtual v8::Handle< Integer > Query(Local< String > key)
virtual v8::Handle< Integer > Query(Local< String > key)
void ReattachGlobal(Handle< Object > global_object)
void SetVerbose(bool value)
virtual v8::Handle< Integer > Query(Local< String > key)
ReappearingPropertyContext()
static v8::Handle< Integer > HandleQuery(Local< String > key, const AccessorInfo &info)
void Check(const char *source, int get, int set, int has, Expectations expectations, v8::Handle< Value > value=Local< Value >())
static v8::Handle< Value > HandleSet(Local< String > key, Local< Value > value, const AccessorInfo &info)
virtual ~DeclarationContext()
virtual Local< ObjectTemplate > GetHolder(Local< FunctionTemplate > function)
virtual Local< ObjectTemplate > GetHolder(Local< FunctionTemplate > function)
virtual v8::Handle< Value > Get(Local< String > key)
virtual v8::Handle< Integer > Query(Local< String > key)
virtual v8::Handle< Integer > Query(Local< String > key)
activate correct semantics for inheriting readonliness false
virtual void PostInitializeContext(Handle< Context > context)
void Check(const char *source, Expectations expectations, v8::Handle< Value > value=Local< Value >())
virtual v8::Handle< Integer > Query(Local< String > key)
AppearingPropertyContext()
virtual void PostInitializeContext(Handle< Context > context)
virtual Local< ObjectTemplate > GetHolder(Local< FunctionTemplate > function)
virtual v8::Handle< Integer > Query(Local< String > key)
Handle< Primitive > V8EXPORT Undefined()
Local< Value > Data() const
virtual v8::Handle< Value > Set(Local< String > key, Local< Value > value)
virtual Local< ObjectTemplate > GetHolder(Local< FunctionTemplate > function)