54 if (is_initialized_) {
63 void Check(
const char* source,
64 int get,
int set,
int has,
77 void InitializeIfNeeded();
86 return function->InstanceTemplate();
102 bool is_initialized_;
114 : is_initialized_(
false), get_count_(0), set_count_(0), query_count_(0) {
120 if (is_initialized_)
return;
132 function->InstanceTemplate(),
134 context_.
Reset(isolate, context);
136 is_initialized_ =
true;
142 int get,
int set,
int query,
184 context->get_count_++;
194 context->set_count_++;
203 context->query_count_++;
237 context.
Check(
"var x; x",
245 context.
Check(
"var x = 0; x",
253 context.
Check(
"function x() { }; x",
261 context.
Check(
"const x; x",
270 context.
Check(
"const x = 0; x",
293 context.
Check(
"var x; x",
301 context.
Check(
"var x = 0; x",
309 context.
Check(
"function x() { }; x",
317 context.
Check(
"const x; x",
325 context.
Check(
"const x = 0; x",
349 context.
Check(
"var x; x",
357 context.
Check(
"var x = 0; x",
365 context.
Check(
"function x() { }; x",
373 context.
Check(
"const x; x",
381 context.
Check(
"const x = 0; x",
389 context.
Check(
"if (false) { var x = 0 }; x",
440 context.
Check(
"var x; x",
448 context.
Check(
"var x = 0; x",
456 context.
Check(
"function x() { }; x",
464 context.
Check(
"const x; x",
472 context.
Check(
"const x = 0; x",
533 context.
Check(
"const x; var x = 0",
554 return function->PrototypeTemplate();
565 context.
Check(
"this.x = 87; this.x",
573 context.
Check(
"var x; x",
581 context.
Check(
"var x = 0; x",
589 context.
Check(
"const x; x",
597 context.
Check(
"const x = 0; x",
616 return function->PrototypeTemplate();
626 context.
Check(
"if (false) { var x = 0; }; x",
640 hidden_proto_->SetHiddenPrototype(
true);
652 Local<Object> hidden_proto = hidden_proto_->GetFunction()->NewInstance();
655 inner_global->SetPrototype(hidden_proto);
660 return hidden_proto_->InstanceTemplate();
668 TEST(ExistsInHiddenPrototype) {
672 context.
Check(
"var x; x",
680 context.
Check(
"var x = 0; x",
688 context.
Check(
"function x() { }; x",
697 context.
Check(
"const x; x",
706 context.
Check(
"const x = 0; x",
719 : handle_scope_(
CcTest::isolate()),
735 Script::Compile(String::NewFromUtf8(context_->GetIsolate(), source));
743 CHECK(!catcher.HasCaught());
744 if (!value.IsEmpty()) {
749 CHECK(catcher.HasCaught());
750 if (!value.IsEmpty()) {
751 CHECK_EQ(value, catcher.Exception());
767 context.
Check(
"var x = 1; x",
769 context.
Check(
"var x = 2; x",
771 context.
Check(
"const x = 3; x",
773 context.
Check(
"const x = 4; x",
775 context.
Check(
"x = 5; x",
777 context.
Check(
"var x = 6; x",
779 context.
Check(
"this.x",
781 context.
Check(
"function x() { return 7 }; x()",
786 context.
Check(
"const x = 1; x",
788 context.
Check(
"var x = 2; x",
790 context.
Check(
"const x = 3; x",
792 context.
Check(
"x = 4; x",
794 context.
Check(
"var x = 5; x",
796 context.
Check(
"this.x",
798 context.
Check(
"function x() { return 7 }; x",
804 TEST(CrossScriptReferencesHarmony) {
805 i::FLAG_use_strict =
true;
806 i::FLAG_harmony_scoping =
true;
807 i::FLAG_harmony_modules =
true;
812 const char* decs[] = {
813 "var x = 1; x",
"x",
"this.x",
814 "function x() { return 1 }; x()",
"x()",
"this.x()",
815 "let x = 1; x",
"x",
"this.x",
816 "const x = 1; x",
"x",
"this.x",
817 "module x { export let a = 1 }; x.a",
"x.a",
"this.x.a",
821 for (
int i = 0; decs[i] !=
NULL; i += 3) {
836 i::FLAG_use_strict =
true;
837 i::FLAG_harmony_scoping =
true;
838 i::FLAG_harmony_modules =
true;
842 const char* firsts[] = {
844 "function x() { return 1 }; x()",
847 "module x { export let a = 1 }; x.a",
850 const char* seconds[] = {
852 "function x() { return 2 }; x()",
855 "module x { export let a = 2 }; x.a",
859 for (
int i = 0; firsts[i] !=
NULL; ++i) {
860 for (
int j = 0; seconds[j] !=
NULL; ++j) {
867 context.
Check(seconds[j],
ExistsInHiddenPrototypeContext()
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
static V8_INLINE Local< T > New(Isolate *isolate, Handle< T > that)
#define CHECK_EQ(expected, value)
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 SetVerbose(bool value)
static void HandleSet(Local< String > key, Local< Value > value, const v8::PropertyCallbackInfo< v8::Value > &info)
virtual v8::Handle< Integer > Query(Local< String > key)
ReappearingPropertyContext()
void Check(const char *source, int get, int set, int has, Expectations expectations, v8::Handle< Value > value=Local< Value >())
virtual ~DeclarationContext()
static void HandleQuery(Local< String > key, const v8::PropertyCallbackInfo< v8::Integer > &info)
virtual Local< ObjectTemplate > GetHolder(Local< FunctionTemplate > function)
virtual Local< ObjectTemplate > GetHolder(Local< FunctionTemplate > function)
void CollectAllAvailableGarbage(const char *gc_reason=NULL)
ExistsInPrototypeContext()
virtual v8::Handle< Value > Get(Local< String > key)
V8_INLINE ReturnValue< T > GetReturnValue() const
virtual v8::Handle< Integer > Query(Local< String > key)
virtual v8::Handle< Integer > Query(Local< String > key)
virtual void PostInitializeContext(Handle< Context > context)
V8_INLINE Handle< Primitive > Undefined(Isolate *isolate)
void Check(const char *source, Expectations expectations, v8::Handle< Value > value=Local< Value >())
bool CollectGarbage(AllocationSpace space, const char *gc_reason=NULL, const GCCallbackFlags gc_callback_flags=kNoGCCallbackFlags)
virtual v8::Handle< Integer > Query(Local< String > key)
AppearingPropertyContext()
V8_INLINE bool IsEmpty() const
v8::Isolate * isolate() const
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function info
virtual void PostInitializeContext(Handle< Context > context)
virtual Local< ObjectTemplate > GetHolder(Local< FunctionTemplate > function)
virtual v8::Handle< Integer > Query(Local< String > key)
static void HandleGet(Local< String > key, const v8::PropertyCallbackInfo< v8::Value > &info)
V8_INLINE Local< Value > Data() const
virtual v8::Handle< Value > Set(Local< String > key, Local< Value > value)
virtual Local< ObjectTemplate > GetHolder(Local< FunctionTemplate > function)
static v8::Isolate * isolate()