v8  3.14.5(node0.10.28)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test-decls.cc
Go to the documentation of this file.
1 // Copyright 2007-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
27 
28 #include <stdlib.h>
29 
30 #include "v8.h"
31 
32 #include "heap.h"
33 #include "cctest.h"
34 
35 using namespace v8;
36 
37 
42 };
43 
44 
45 // A DeclarationContext holds a reference to a v8::Context and keeps
46 // track of various declaration related counters to make it easier to
47 // track if global declarations in the presence of interceptors behave
48 // the right way.
50  public:
52 
53  virtual ~DeclarationContext() {
54  if (is_initialized_) {
55  context_->Exit();
56  context_.Dispose();
57  }
58  }
59 
60  void Check(const char* source,
61  int get, int set, int has,
62  Expectations expectations,
64 
65  int get_count() const { return get_count_; }
66  int set_count() const { return set_count_; }
67  int query_count() const { return query_count_; }
68 
69  protected:
70  virtual v8::Handle<Value> Get(Local<String> key);
71  virtual v8::Handle<Value> Set(Local<String> key, Local<Value> value);
72  virtual v8::Handle<Integer> Query(Local<String> key);
73 
74  void InitializeIfNeeded();
75 
76  // Perform optional initialization steps on the context after it has
77  // been created. Defaults to none but may be overwritten.
78  virtual void PostInitializeContext(Handle<Context> context) {}
79 
80  // Get the holder for the interceptor. Default to the instance template
81  // but may be overwritten.
83  return function->InstanceTemplate();
84  }
85 
86  // The handlers are called as static functions that forward
87  // to the instance specific virtual methods.
88  static v8::Handle<Value> HandleGet(Local<String> key,
89  const AccessorInfo& info);
90  static v8::Handle<Value> HandleSet(Local<String> key,
91  Local<Value> value,
92  const AccessorInfo& info);
93  static v8::Handle<Integer> HandleQuery(Local<String> key,
94  const AccessorInfo& info);
95 
96  private:
97  bool is_initialized_;
98  Persistent<Context> context_;
99 
100  int get_count_;
101  int set_count_;
102  int query_count_;
103 
104  static DeclarationContext* GetInstance(const AccessorInfo& info);
105 };
106 
107 
109  : is_initialized_(false), get_count_(0), set_count_(0), query_count_(0) {
110  // Do nothing.
111 }
112 
113 
115  if (is_initialized_) return;
116  HandleScope scope;
117  Local<FunctionTemplate> function = FunctionTemplate::New();
118  Local<Value> data = External::New(this);
119  GetHolder(function)->SetNamedPropertyHandler(&HandleGet,
120  &HandleSet,
121  &HandleQuery,
122  0, 0,
123  data);
124  context_ = Context::New(0, function->InstanceTemplate(), Local<Value>());
125  context_->Enter();
126  is_initialized_ = true;
127  PostInitializeContext(context_);
128 }
129 
130 
131 void DeclarationContext::Check(const char* source,
132  int get, int set, int query,
133  Expectations expectations,
134  v8::Handle<Value> value) {
136  // A retry after a GC may pollute the counts, so perform gc now
137  // to avoid that.
138  HEAP->CollectGarbage(v8::internal::NEW_SPACE);
139  HandleScope scope;
140  TryCatch catcher;
141  catcher.SetVerbose(true);
142  Local<Script> script = Script::Compile(String::New(source));
143  if (expectations == EXPECT_ERROR) {
144  CHECK(script.IsEmpty());
145  return;
146  }
147  CHECK(!script.IsEmpty());
148  Local<Value> result = script->Run();
149  CHECK_EQ(get, get_count());
150  CHECK_EQ(set, set_count());
151  CHECK_EQ(query, query_count());
152  if (expectations == EXPECT_RESULT) {
153  CHECK(!catcher.HasCaught());
154  if (!value.IsEmpty()) {
155  CHECK_EQ(value, result);
156  }
157  } else {
158  CHECK(expectations == EXPECT_EXCEPTION);
159  CHECK(catcher.HasCaught());
160  if (!value.IsEmpty()) {
161  CHECK_EQ(value, catcher.Exception());
162  }
163  }
164 }
165 
166 
168  const AccessorInfo& info) {
169  DeclarationContext* context = GetInstance(info);
170  context->get_count_++;
171  return context->Get(key);
172 }
173 
174 
176  Local<Value> value,
177  const AccessorInfo& info) {
178  DeclarationContext* context = GetInstance(info);
179  context->set_count_++;
180  return context->Set(key, value);
181 }
182 
183 
185  const AccessorInfo& info) {
186  DeclarationContext* context = GetInstance(info);
187  context->query_count_++;
188  return context->Query(key);
189 }
190 
191 
192 DeclarationContext* DeclarationContext::GetInstance(const AccessorInfo& info) {
193  return static_cast<DeclarationContext*>(External::Unwrap(info.Data()));
194 }
195 
196 
198  return v8::Handle<Value>();
199 }
200 
201 
203  Local<Value> value) {
204  return v8::Handle<Value>();
205 }
206 
207 
209  return v8::Handle<Integer>();
210 }
211 
212 
213 // Test global declaration of a property the interceptor doesn't know
214 // about and doesn't handle.
215 TEST(Unknown) {
216  HandleScope scope;
217 
218  { DeclarationContext context;
219  context.Check("var x; x",
220  1, // access
221  1, // declaration
222  2, // declaration + initialization
224  }
225 
226  { DeclarationContext context;
227  context.Check("var x = 0; x",
228  1, // access
229  2, // declaration + initialization
230  2, // declaration + initialization
231  EXPECT_RESULT, Number::New(0));
232  }
233 
234  { DeclarationContext context;
235  context.Check("function x() { }; x",
236  1, // access
237  0,
238  0,
239  EXPECT_RESULT);
240  }
241 
242  { DeclarationContext context;
243  context.Check("const x; x",
244  1, // access
245  2, // declaration + initialization
246  1, // declaration
248  }
249 
250  { DeclarationContext context;
251  context.Check("const x = 0; x",
252  1, // access
253  2, // declaration + initialization
254  1, // declaration
255  EXPECT_RESULT, Undefined()); // SB 0 - BUG 1213579
256  }
257 }
258 
259 
260 
262  protected:
264  return Integer::New(v8::None);
265  }
266 };
267 
268 
269 
270 TEST(Present) {
271  HandleScope scope;
272 
273  { PresentPropertyContext context;
274  context.Check("var x; x",
275  1, // access
276  0,
277  2, // declaration + initialization
278  EXPECT_EXCEPTION); // x is not defined!
279  }
280 
281  { PresentPropertyContext context;
282  context.Check("var x = 0; x",
283  1, // access
284  1, // initialization
285  2, // declaration + initialization
286  EXPECT_RESULT, Number::New(0));
287  }
288 
289  { PresentPropertyContext context;
290  context.Check("function x() { }; x",
291  1, // access
292  0,
293  0,
294  EXPECT_RESULT);
295  }
296 
297  { PresentPropertyContext context;
298  context.Check("const x; x",
299  1, // access
300  1, // initialization
301  1, // (re-)declaration
303  }
304 
305  { PresentPropertyContext context;
306  context.Check("const x = 0; x",
307  1, // access
308  1, // initialization
309  1, // (re-)declaration
310  EXPECT_RESULT, Number::New(0));
311  }
312 }
313 
314 
315 
317  protected:
319  return v8::Handle<Integer>();
320  }
321 };
322 
323 
324 TEST(Absent) {
325  HandleScope scope;
326 
327  { AbsentPropertyContext context;
328  context.Check("var x; x",
329  1, // access
330  1, // declaration
331  2, // declaration + initialization
333  }
334 
335  { AbsentPropertyContext context;
336  context.Check("var x = 0; x",
337  1, // access
338  2, // declaration + initialization
339  2, // declaration + initialization
340  EXPECT_RESULT, Number::New(0));
341  }
342 
343  { AbsentPropertyContext context;
344  context.Check("function x() { }; x",
345  1, // access
346  0,
347  0,
348  EXPECT_RESULT);
349  }
350 
351  { AbsentPropertyContext context;
352  context.Check("const x; x",
353  1, // access
354  2, // declaration + initialization
355  1, // declaration
357  }
358 
359  { AbsentPropertyContext context;
360  context.Check("const x = 0; x",
361  1, // access
362  2, // declaration + initialization
363  1, // declaration
364  EXPECT_RESULT, Undefined()); // SB 0 - BUG 1213579
365  }
366 
367  { AbsentPropertyContext context;
368  context.Check("if (false) { var x = 0 }; x",
369  1, // access
370  1, // declaration
371  1, // declaration + initialization
373  }
374 }
375 
376 
377 
379  public:
380  enum State {
384  };
385 
387 
388  protected:
390  switch (state_) {
391  case DECLARE:
392  // Force declaration by returning that the
393  // property is absent.
394  state_ = INITIALIZE_IF_ASSIGN;
395  return Handle<Integer>();
397  // Return that the property is present so we only get the
398  // setter called when initializing with a value.
399  state_ = UNKNOWN;
400  return Integer::New(v8::None);
401  default:
402  CHECK(state_ == UNKNOWN);
403  break;
404  }
405  // Do the lookup in the object.
406  return v8::Handle<Integer>();
407  }
408 
409  private:
410  State state_;
411 };
412 
413 
414 TEST(Appearing) {
415  HandleScope scope;
416 
417  { AppearingPropertyContext context;
418  context.Check("var x; x",
419  1, // access
420  1, // declaration
421  2, // declaration + initialization
423  }
424 
425  { AppearingPropertyContext context;
426  context.Check("var x = 0; x",
427  1, // access
428  2, // declaration + initialization
429  2, // declaration + initialization
430  EXPECT_RESULT, Number::New(0));
431  }
432 
433  { AppearingPropertyContext context;
434  context.Check("function x() { }; x",
435  1, // access
436  0,
437  0,
438  EXPECT_RESULT);
439  }
440 
441  { AppearingPropertyContext context;
442  context.Check("const x; x",
443  1, // access
444  2, // declaration + initialization
445  1, // declaration
447  }
448 
449  { AppearingPropertyContext context;
450  context.Check("const x = 0; x",
451  1, // access
452  2, // declaration + initialization
453  1, // declaration
455  // Result is undefined because declaration succeeded but
456  // initialization to 0 failed (due to context behavior).
457  }
458 }
459 
460 
461 
463  public:
464  enum State {
469  };
470 
472 
473  protected:
475  switch (state_) {
476  case DECLARE:
477  // Force the first declaration by returning that
478  // the property is absent.
479  state_ = DONT_DECLARE;
480  return Handle<Integer>();
481  case DONT_DECLARE:
482  // Ignore the second declaration by returning
483  // that the property is already there.
484  state_ = INITIALIZE;
485  return Integer::New(v8::None);
486  case INITIALIZE:
487  // Force an initialization by returning that
488  // the property is absent. This will make sure
489  // that the setter is called and it will not
490  // lead to redeclaration conflicts (yet).
491  state_ = UNKNOWN;
492  return Handle<Integer>();
493  default:
494  CHECK(state_ == UNKNOWN);
495  break;
496  }
497  // Do the lookup in the object.
498  return Handle<Integer>();
499  }
500 
501  private:
502  State state_;
503 };
504 
505 
506 TEST(Reappearing) {
507  HandleScope scope;
508 
509  { ReappearingPropertyContext context;
510  context.Check("const x; var x = 0",
511  0,
512  3, // const declaration+initialization, var initialization
513  3, // 2 x declaration + var initialization
515  }
516 }
517 
518 
519 
521  protected:
523  // Let it seem that the property exists in the prototype object.
524  return Integer::New(v8::None);
525  }
526 
527  // Use the prototype as the holder for the interceptors.
529  return function->PrototypeTemplate();
530  }
531 };
532 
533 
534 TEST(ExistsInPrototype) {
535  i::FLAG_es52_globals = true;
536  HandleScope scope;
537 
538  // Sanity check to make sure that the holder of the interceptor
539  // really is the prototype object.
540  { ExistsInPrototypeContext context;
541  context.Check("this.x = 87; this.x",
542  0,
543  0,
544  0,
545  EXPECT_RESULT, Number::New(87));
546  }
547 
548  { ExistsInPrototypeContext context;
549  context.Check("var x; x",
550  0,
551  0,
552  0,
554  }
555 
556  { ExistsInPrototypeContext context;
557  context.Check("var x = 0; x",
558  0,
559  0,
560  0,
561  EXPECT_RESULT, Number::New(0));
562  }
563 
564  { ExistsInPrototypeContext context;
565  context.Check("const x; x",
566  0,
567  0,
568  0,
570  }
571 
572  { ExistsInPrototypeContext context;
573  context.Check("const x = 0; x",
574  0,
575  0,
576  0,
577  EXPECT_RESULT, Number::New(0));
578  }
579 }
580 
581 
582 
584  protected:
586  // Let it seem that the property is absent in the prototype object.
587  return Handle<Integer>();
588  }
589 
590  // Use the prototype as the holder for the interceptors.
592  return function->PrototypeTemplate();
593  }
594 };
595 
596 
597 TEST(AbsentInPrototype) {
598  i::FLAG_es52_globals = true;
599  HandleScope scope;
600 
601  { AbsentInPrototypeContext context;
602  context.Check("if (false) { var x = 0; }; x",
603  0,
604  0,
605  0,
607  }
608 }
609 
610 
611 
613  public:
615  hidden_proto_ = FunctionTemplate::New();
616  hidden_proto_->SetHiddenPrototype(true);
617  }
618 
619  protected:
621  // Let it seem that the property exists in the hidden prototype object.
622  return Integer::New(v8::None);
623  }
624 
625  // Install the hidden prototype after the global object has been created.
626  virtual void PostInitializeContext(Handle<Context> context) {
627  Local<Object> global_object = context->Global();
628  Local<Object> hidden_proto = hidden_proto_->GetFunction()->NewInstance();
629  context->DetachGlobal();
630  context->Global()->SetPrototype(hidden_proto);
631  context->ReattachGlobal(global_object);
632  }
633 
634  // Use the hidden prototype as the holder for the interceptors.
636  return hidden_proto_->InstanceTemplate();
637  }
638 
639  private:
640  Local<FunctionTemplate> hidden_proto_;
641 };
642 
643 
644 TEST(ExistsInHiddenPrototype) {
645  i::FLAG_es52_globals = true;
646  HandleScope scope;
647 
649  context.Check("var x; x",
650  1, // access
651  0,
652  2, // declaration + initialization
653  EXPECT_EXCEPTION); // x is not defined!
654  }
655 
657  context.Check("var x = 0; x",
658  1, // access
659  1, // initialization
660  2, // declaration + initialization
661  EXPECT_RESULT, Number::New(0));
662  }
663 
665  context.Check("function x() { }; x",
666  0,
667  0,
668  0,
669  EXPECT_RESULT);
670  }
671 
672  // TODO(mstarzinger): The semantics of global const is vague.
674  context.Check("const x; x",
675  0,
676  0,
677  1, // (re-)declaration
679  }
680 
681  // TODO(mstarzinger): The semantics of global const is vague.
683  context.Check("const x = 0; x",
684  0,
685  0,
686  1, // (re-)declaration
687  EXPECT_RESULT, Number::New(0));
688  }
689 }
690 
691 
692 
694  public:
696  context_ = Context::New(0);
697  context_->Enter();
698  }
699 
700  virtual ~SimpleContext() {
701  context_->Exit();
702  context_.Dispose();
703  }
704 
705  void Check(const char* source,
706  Expectations expectations,
707  v8::Handle<Value> value = Local<Value>()) {
708  HandleScope scope;
709  TryCatch catcher;
710  catcher.SetVerbose(true);
711  Local<Script> script = Script::Compile(String::New(source));
712  if (expectations == EXPECT_ERROR) {
713  CHECK(script.IsEmpty());
714  return;
715  }
716  CHECK(!script.IsEmpty());
717  Local<Value> result = script->Run();
718  if (expectations == EXPECT_RESULT) {
719  CHECK(!catcher.HasCaught());
720  if (!value.IsEmpty()) {
721  CHECK_EQ(value, result);
722  }
723  } else {
724  CHECK(expectations == EXPECT_EXCEPTION);
725  CHECK(catcher.HasCaught());
726  if (!value.IsEmpty()) {
727  CHECK_EQ(value, catcher.Exception());
728  }
729  }
730  }
731 
732  private:
733  Persistent<Context> context_;
734 };
735 
736 
737 TEST(MultiScriptConflicts) {
738  HandleScope scope;
739 
740  { SimpleContext context;
741  context.Check("var x = 1; x",
742  EXPECT_RESULT, Number::New(1));
743  context.Check("var x = 2; x",
744  EXPECT_RESULT, Number::New(2));
745  context.Check("const x = 3; x",
746  EXPECT_RESULT, Number::New(3));
747  context.Check("const x = 4; x",
748  EXPECT_RESULT, Number::New(4));
749  context.Check("x = 5; x",
750  EXPECT_RESULT, Number::New(5));
751  context.Check("var x = 6; x",
752  EXPECT_RESULT, Number::New(6));
753  context.Check("this.x",
754  EXPECT_RESULT, Number::New(6));
755  context.Check("function x() { return 7 }; x()",
756  EXPECT_RESULT, Number::New(7));
757  }
758 
759  { SimpleContext context;
760  context.Check("const x = 1; x",
761  EXPECT_RESULT, Number::New(1));
762  context.Check("var x = 2; x", // assignment ignored
763  EXPECT_RESULT, Number::New(1));
764  context.Check("const x = 3; x",
765  EXPECT_RESULT, Number::New(1));
766  context.Check("x = 4; x", // assignment ignored
767  EXPECT_RESULT, Number::New(1));
768  context.Check("var x = 5; x", // assignment ignored
769  EXPECT_RESULT, Number::New(1));
770  context.Check("this.x",
771  EXPECT_RESULT, Number::New(1));
772  context.Check("function x() { return 7 }; x",
774  }
775 
776  i::FLAG_use_strict = true;
777  i::FLAG_harmony_scoping = true;
778 
779  { SimpleContext context;
780  context.Check("var x = 1; x",
781  EXPECT_RESULT, Number::New(1));
782  context.Check("x",
783  EXPECT_RESULT, Number::New(1));
784  context.Check("this.x",
785  EXPECT_RESULT, Number::New(1));
786  }
787 
788  { SimpleContext context;
789  context.Check("function x() { return 4 }; x()",
790  EXPECT_RESULT, Number::New(4));
791  context.Check("x()",
792  EXPECT_RESULT, Number::New(4));
793  context.Check("this.x()",
794  EXPECT_RESULT, Number::New(4));
795  }
796 
797  { SimpleContext context;
798  context.Check("let x = 2; x",
799  EXPECT_RESULT, Number::New(2));
800  context.Check("x",
801  EXPECT_RESULT, Number::New(2));
802  // TODO(rossberg): The current ES6 draft spec does not reflect lexical
803  // bindings on the global object. However, this will probably change, in
804  // which case we reactivate the following test.
805  // context.Check("this.x",
806  // EXPECT_RESULT, Number::New(2));
807  }
808 
809  { SimpleContext context;
810  context.Check("const x = 3; x",
811  EXPECT_RESULT, Number::New(3));
812  context.Check("x",
813  EXPECT_RESULT, Number::New(3));
814  // TODO(rossberg): The current ES6 draft spec does not reflect lexical
815  // bindings on the global object. However, this will probably change, in
816  // which case we reactivate the following test.
817  // context.Check("this.x",
818  // EXPECT_RESULT, Number::New(3));
819  }
820 
821  // TODO(rossberg): All of the below should actually be errors in Harmony.
822 
823  { SimpleContext context;
824  context.Check("var x = 1; x",
825  EXPECT_RESULT, Number::New(1));
826  context.Check("let x = 2; x",
827  EXPECT_RESULT, Number::New(2));
828  }
829 
830  { SimpleContext context;
831  context.Check("var x = 1; x",
832  EXPECT_RESULT, Number::New(1));
833  context.Check("const x = 2; x",
834  EXPECT_RESULT, Number::New(2));
835  }
836 
837  { SimpleContext context;
838  context.Check("function x() { return 1 }; x()",
839  EXPECT_RESULT, Number::New(1));
840  context.Check("let x = 2; x",
841  EXPECT_RESULT, Number::New(2));
842  }
843 
844  { SimpleContext context;
845  context.Check("function x() { return 1 }; x()",
846  EXPECT_RESULT, Number::New(1));
847  context.Check("const x = 2; x",
848  EXPECT_RESULT, Number::New(2));
849  }
850 
851  { SimpleContext context;
852  context.Check("let x = 1; x",
853  EXPECT_RESULT, Number::New(1));
854  context.Check("var x = 2; x",
855  EXPECT_ERROR);
856  }
857 
858  { SimpleContext context;
859  context.Check("let x = 1; x",
860  EXPECT_RESULT, Number::New(1));
861  context.Check("let x = 2; x",
862  EXPECT_ERROR);
863  }
864 
865  { SimpleContext context;
866  context.Check("let x = 1; x",
867  EXPECT_RESULT, Number::New(1));
868  context.Check("const x = 2; x",
869  EXPECT_ERROR);
870  }
871 
872  { SimpleContext context;
873  context.Check("let x = 1; x",
874  EXPECT_RESULT, Number::New(1));
875  context.Check("function x() { return 2 }; x()",
876  EXPECT_ERROR);
877  }
878 
879  { SimpleContext context;
880  context.Check("const x = 1; x",
881  EXPECT_RESULT, Number::New(1));
882  context.Check("var x = 2; x",
883  EXPECT_ERROR);
884  }
885 
886  { SimpleContext context;
887  context.Check("const x = 1; x",
888  EXPECT_RESULT, Number::New(1));
889  context.Check("let x = 2; x",
890  EXPECT_ERROR);
891  }
892 
893  { SimpleContext context;
894  context.Check("const x = 1; x",
895  EXPECT_RESULT, Number::New(1));
896  context.Check("const x = 2; x",
897  EXPECT_ERROR);
898  }
899 
900  { SimpleContext context;
901  context.Check("const x = 1; x",
902  EXPECT_RESULT, Number::New(1));
903  context.Check("function x() { return 2 }; x()",
904  EXPECT_ERROR);
905  }
906 }
#define CHECK_EQ(expected, value)
Definition: checks.h:219
void Dispose()
Definition: v8.h:4235
static v8::Handle< Value > HandleGet(Local< String > key, const AccessorInfo &info)
Definition: test-decls.cc:167
Local< Value > Exception() const
Definition: api.cc:1720
TEST(Unknown)
Definition: test-decls.cc:215
int get_count() const
Definition: test-decls.cc:65
void InitializeIfNeeded()
Definition: test-decls.cc:114
bool HasCaught() const
Definition: api.cc:1703
virtual v8::Handle< Integer > Query(Local< String > key)
Definition: test-decls.cc:474
virtual v8::Handle< Integer > Query(Local< String > key)
Definition: test-decls.cc:208
virtual v8::Handle< Integer > Query(Local< String > key)
Definition: test-decls.cc:585
void ReattachGlobal(Handle< Object > global_object)
Definition: api.cc:4593
#define CHECK(condition)
Definition: checks.h:56
void SetVerbose(bool value)
Definition: api.cc:1768
virtual v8::Handle< Integer > Query(Local< String > key)
Definition: test-decls.cc:389
static v8::Handle< Integer > HandleQuery(Local< String > key, const AccessorInfo &info)
Definition: test-decls.cc:184
void Check(const char *source, int get, int set, int has, Expectations expectations, v8::Handle< Value > value=Local< Value >())
Definition: test-decls.cc:131
static v8::Handle< Value > HandleSet(Local< String > key, Local< Value > value, const AccessorInfo &info)
Definition: test-decls.cc:175
virtual ~DeclarationContext()
Definition: test-decls.cc:53
void DetachGlobal()
Definition: api.cc:4582
virtual Local< ObjectTemplate > GetHolder(Local< FunctionTemplate > function)
Definition: test-decls.cc:591
virtual Local< ObjectTemplate > GetHolder(Local< FunctionTemplate > function)
Definition: test-decls.cc:635
Local< Object > Global()
Definition: api.cc:4570
virtual v8::Handle< Value > Get(Local< String > key)
Definition: test-decls.cc:197
virtual v8::Handle< Integer > Query(Local< String > key)
Definition: test-decls.cc:620
int set_count() const
Definition: test-decls.cc:66
virtual v8::Handle< Integer > Query(Local< String > key)
Definition: test-decls.cc:522
activate correct semantics for inheriting readonliness false
virtual void PostInitializeContext(Handle< Context > context)
Definition: test-decls.cc:626
void Check(const char *source, Expectations expectations, v8::Handle< Value > value=Local< Value >())
Definition: test-decls.cc:705
virtual v8::Handle< Integer > Query(Local< String > key)
Definition: test-decls.cc:263
virtual ~SimpleContext()
Definition: test-decls.cc:700
Definition: v8.h:1425
virtual void PostInitializeContext(Handle< Context > context)
Definition: test-decls.cc:78
virtual Local< ObjectTemplate > GetHolder(Local< FunctionTemplate > function)
Definition: test-decls.cc:528
#define HEAP
Definition: isolate.h:1433
virtual v8::Handle< Integer > Query(Local< String > key)
Definition: test-decls.cc:318
Handle< Primitive > V8EXPORT Undefined()
Definition: api.cc:549
bool IsEmpty() const
Definition: v8.h:209
Local< Value > Run()
Definition: api.cc:1598
Local< Value > Data() const
Definition: v8.h:4618
int query_count() const
Definition: test-decls.cc:67
Definition: v8.h:106
Expectations
Definition: test-decls.cc:38
virtual v8::Handle< Value > Set(Local< String > key, Local< Value > value)
Definition: test-decls.cc:202
virtual Local< ObjectTemplate > GetHolder(Local< FunctionTemplate > function)
Definition: test-decls.cc:82