Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: test/cctest/test-api.cc

Issue 1018513003: Set test expectations prior to enabling --turbo-osr. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/test-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 19886 matching lines...) Expand 10 before | Expand all | Expand 10 after
19897 19897
19898 19898
19899 class RequestInterruptTestWithFunctionCall 19899 class RequestInterruptTestWithFunctionCall
19900 : public RequestInterruptTestBaseWithSimpleInterrupt { 19900 : public RequestInterruptTestBaseWithSimpleInterrupt {
19901 public: 19901 public:
19902 virtual void TestBody() { 19902 virtual void TestBody() {
19903 Local<Function> func = Function::New( 19903 Local<Function> func = Function::New(
19904 isolate_, ShouldContinueCallback, v8::External::New(isolate_, this)); 19904 isolate_, ShouldContinueCallback, v8::External::New(isolate_, this));
19905 env_->Global()->Set(v8_str("ShouldContinue"), func); 19905 env_->Global()->Set(v8_str("ShouldContinue"), func);
19906 19906
19907 i::FLAG_turbo_osr = false; // TODO(titzer): interrupts in TF loops.
19907 CompileRun("while (ShouldContinue()) { }"); 19908 CompileRun("while (ShouldContinue()) { }");
19908 } 19909 }
19909 }; 19910 };
19910 19911
19911 19912
19912 class RequestInterruptTestWithMethodCall 19913 class RequestInterruptTestWithMethodCall
19913 : public RequestInterruptTestBaseWithSimpleInterrupt { 19914 : public RequestInterruptTestBaseWithSimpleInterrupt {
19914 public: 19915 public:
19915 virtual void TestBody() { 19916 virtual void TestBody() {
19916 v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_); 19917 v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_);
19917 v8::Local<v8::Template> proto = t->PrototypeTemplate(); 19918 v8::Local<v8::Template> proto = t->PrototypeTemplate();
19918 proto->Set(v8_str("shouldContinue"), Function::New( 19919 proto->Set(v8_str("shouldContinue"), Function::New(
19919 isolate_, ShouldContinueCallback, v8::External::New(isolate_, this))); 19920 isolate_, ShouldContinueCallback, v8::External::New(isolate_, this)));
19920 env_->Global()->Set(v8_str("Klass"), t->GetFunction()); 19921 env_->Global()->Set(v8_str("Klass"), t->GetFunction());
19921 19922
19923 i::FLAG_turbo_osr = false; // TODO(titzer): interrupts in TF loops.
19922 CompileRun("var obj = new Klass; while (obj.shouldContinue()) { }"); 19924 CompileRun("var obj = new Klass; while (obj.shouldContinue()) { }");
19923 } 19925 }
19924 }; 19926 };
19925 19927
19926 19928
19927 class RequestInterruptTestWithAccessor 19929 class RequestInterruptTestWithAccessor
19928 : public RequestInterruptTestBaseWithSimpleInterrupt { 19930 : public RequestInterruptTestBaseWithSimpleInterrupt {
19929 public: 19931 public:
19930 virtual void TestBody() { 19932 virtual void TestBody() {
19931 v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_); 19933 v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_);
19932 v8::Local<v8::Template> proto = t->PrototypeTemplate(); 19934 v8::Local<v8::Template> proto = t->PrototypeTemplate();
19933 proto->SetAccessorProperty(v8_str("shouldContinue"), FunctionTemplate::New( 19935 proto->SetAccessorProperty(v8_str("shouldContinue"), FunctionTemplate::New(
19934 isolate_, ShouldContinueCallback, v8::External::New(isolate_, this))); 19936 isolate_, ShouldContinueCallback, v8::External::New(isolate_, this)));
19935 env_->Global()->Set(v8_str("Klass"), t->GetFunction()); 19937 env_->Global()->Set(v8_str("Klass"), t->GetFunction());
19936 19938
19939 i::FLAG_turbo_osr = false; // TODO(titzer): interrupts in TF loops.
19937 CompileRun("var obj = new Klass; while (obj.shouldContinue) { }"); 19940 CompileRun("var obj = new Klass; while (obj.shouldContinue) { }");
19938 } 19941 }
19939 }; 19942 };
19940 19943
19941 19944
19942 class RequestInterruptTestWithNativeAccessor 19945 class RequestInterruptTestWithNativeAccessor
19943 : public RequestInterruptTestBaseWithSimpleInterrupt { 19946 : public RequestInterruptTestBaseWithSimpleInterrupt {
19944 public: 19947 public:
19945 virtual void TestBody() { 19948 virtual void TestBody() {
19946 v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_); 19949 v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_);
19947 t->InstanceTemplate()->SetNativeDataProperty( 19950 t->InstanceTemplate()->SetNativeDataProperty(
19948 v8_str("shouldContinue"), 19951 v8_str("shouldContinue"),
19949 &ShouldContinueNativeGetter, 19952 &ShouldContinueNativeGetter,
19950 NULL, 19953 NULL,
19951 v8::External::New(isolate_, this)); 19954 v8::External::New(isolate_, this));
19952 env_->Global()->Set(v8_str("Klass"), t->GetFunction()); 19955 env_->Global()->Set(v8_str("Klass"), t->GetFunction());
19953 19956
19957 i::FLAG_turbo_osr = false; // TODO(titzer): interrupts in TF loops.
19954 CompileRun("var obj = new Klass; while (obj.shouldContinue) { }"); 19958 CompileRun("var obj = new Klass; while (obj.shouldContinue) { }");
19955 } 19959 }
19956 19960
19957 private: 19961 private:
19958 static void ShouldContinueNativeGetter( 19962 static void ShouldContinueNativeGetter(
19959 Local<String> property, 19963 Local<String> property,
19960 const v8::PropertyCallbackInfo<v8::Value>& info) { 19964 const v8::PropertyCallbackInfo<v8::Value>& info) {
19961 RequestInterruptTestBase* test = 19965 RequestInterruptTestBase* test =
19962 reinterpret_cast<RequestInterruptTestBase*>( 19966 reinterpret_cast<RequestInterruptTestBase*>(
19963 info.Data().As<v8::External>()->Value()); 19967 info.Data().As<v8::External>()->Value());
19964 info.GetReturnValue().Set(test->ShouldContinue()); 19968 info.GetReturnValue().Set(test->ShouldContinue());
19965 } 19969 }
19966 }; 19970 };
19967 19971
19968 19972
19969 class RequestInterruptTestWithMethodCallAndInterceptor 19973 class RequestInterruptTestWithMethodCallAndInterceptor
19970 : public RequestInterruptTestBaseWithSimpleInterrupt { 19974 : public RequestInterruptTestBaseWithSimpleInterrupt {
19971 public: 19975 public:
19972 virtual void TestBody() { 19976 virtual void TestBody() {
19973 v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_); 19977 v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate_);
19974 v8::Local<v8::Template> proto = t->PrototypeTemplate(); 19978 v8::Local<v8::Template> proto = t->PrototypeTemplate();
19975 proto->Set(v8_str("shouldContinue"), Function::New( 19979 proto->Set(v8_str("shouldContinue"), Function::New(
19976 isolate_, ShouldContinueCallback, v8::External::New(isolate_, this))); 19980 isolate_, ShouldContinueCallback, v8::External::New(isolate_, this)));
19977 v8::Local<v8::ObjectTemplate> instance_template = t->InstanceTemplate(); 19981 v8::Local<v8::ObjectTemplate> instance_template = t->InstanceTemplate();
19978 instance_template->SetHandler( 19982 instance_template->SetHandler(
19979 v8::NamedPropertyHandlerConfiguration(EmptyInterceptor)); 19983 v8::NamedPropertyHandlerConfiguration(EmptyInterceptor));
19980 19984
19981 env_->Global()->Set(v8_str("Klass"), t->GetFunction()); 19985 env_->Global()->Set(v8_str("Klass"), t->GetFunction());
19982 19986
19987 i::FLAG_turbo_osr = false; // TODO(titzer): interrupts in TF loops.
19983 CompileRun("var obj = new Klass; while (obj.shouldContinue()) { }"); 19988 CompileRun("var obj = new Klass; while (obj.shouldContinue()) { }");
19984 } 19989 }
19985 19990
19986 private: 19991 private:
19987 static void EmptyInterceptor( 19992 static void EmptyInterceptor(
19988 Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) {} 19993 Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) {}
19989 }; 19994 };
19990 19995
19991 19996
19992 class RequestInterruptTestWithMathAbs 19997 class RequestInterruptTestWithMathAbs
19993 : public RequestInterruptTestBaseWithSimpleInterrupt { 19998 : public RequestInterruptTestBaseWithSimpleInterrupt {
19994 public: 19999 public:
19995 virtual void TestBody() { 20000 virtual void TestBody() {
19996 env_->Global()->Set(v8_str("WakeUpInterruptor"), Function::New( 20001 env_->Global()->Set(v8_str("WakeUpInterruptor"), Function::New(
19997 isolate_, 20002 isolate_,
19998 WakeUpInterruptorCallback, 20003 WakeUpInterruptorCallback,
19999 v8::External::New(isolate_, this))); 20004 v8::External::New(isolate_, this)));
20000 20005
20001 env_->Global()->Set(v8_str("ShouldContinue"), Function::New( 20006 env_->Global()->Set(v8_str("ShouldContinue"), Function::New(
20002 isolate_, 20007 isolate_,
20003 ShouldContinueCallback, 20008 ShouldContinueCallback,
20004 v8::External::New(isolate_, this))); 20009 v8::External::New(isolate_, this)));
20005 20010
20006 i::FLAG_allow_natives_syntax = true; 20011 i::FLAG_allow_natives_syntax = true;
20012 i::FLAG_turbo_osr = false; // TODO(titzer): interrupts in TF loops.
20007 CompileRun("function loopish(o) {" 20013 CompileRun("function loopish(o) {"
20008 " var pre = 10;" 20014 " var pre = 10;"
20009 " while (o.abs(1) > 0) {" 20015 " while (o.abs(1) > 0) {"
20010 " if (o.abs(1) >= 0 && !ShouldContinue()) break;" 20016 " if (o.abs(1) >= 0 && !ShouldContinue()) break;"
20011 " if (pre > 0) {" 20017 " if (pre > 0) {"
20012 " if (--pre === 0) WakeUpInterruptor(o === Math);" 20018 " if (--pre === 0) WakeUpInterruptor(o === Math);"
20013 " }" 20019 " }"
20014 " }" 20020 " }"
20015 "}" 20021 "}"
20016 "var i = 50;" 20022 "var i = 50;"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
20080 20086
20081 virtual void StartInterruptThread() { 20087 virtual void StartInterruptThread() {
20082 i_thread.Start(); 20088 i_thread.Start();
20083 } 20089 }
20084 20090
20085 virtual void TestBody() { 20091 virtual void TestBody() {
20086 Local<Function> func = Function::New( 20092 Local<Function> func = Function::New(
20087 isolate_, ShouldContinueCallback, v8::External::New(isolate_, this)); 20093 isolate_, ShouldContinueCallback, v8::External::New(isolate_, this));
20088 env_->Global()->Set(v8_str("ShouldContinue"), func); 20094 env_->Global()->Set(v8_str("ShouldContinue"), func);
20089 20095
20096 i::FLAG_turbo_osr = false; // TODO(titzer): interrupts in TF loops.
20090 CompileRun("while (ShouldContinue()) { }"); 20097 CompileRun("while (ShouldContinue()) { }");
20091 } 20098 }
20092 20099
20093 private: 20100 private:
20094 class InterruptThread : public v8::base::Thread { 20101 class InterruptThread : public v8::base::Thread {
20095 public: 20102 public:
20096 enum { NUM_INTERRUPTS = 10 }; 20103 enum { NUM_INTERRUPTS = 10 };
20097 explicit InterruptThread(RequestMultipleInterrupts* test) 20104 explicit InterruptThread(RequestMultipleInterrupts* test)
20098 : Thread(Options("RequestInterruptTest")), test_(test) {} 20105 : Thread(Options("RequestInterruptTest")), test_(test) {}
20099 20106
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
21600 "function Module(stdlib, foreign, heap) {" 21607 "function Module(stdlib, foreign, heap) {"
21601 " 'use asm';" 21608 " 'use asm';"
21602 " var MEM32 = new stdlib.Int32Array(heap);" 21609 " var MEM32 = new stdlib.Int32Array(heap);"
21603 " function load() { return MEM32[0]; }" 21610 " function load() { return MEM32[0]; }"
21604 " return { load: load };" 21611 " return { load: load };"
21605 "}" 21612 "}"
21606 "var buffer = new ArrayBuffer(4);" 21613 "var buffer = new ArrayBuffer(4);"
21607 "Module(this, {}, buffer).load();" 21614 "Module(this, {}, buffer).load();"
21608 "buffer"; 21615 "buffer";
21609 21616
21617 i::FLAG_turbo_osr = false; // TODO(titzer): test requires eager TF.
21610 v8::Local<v8::ArrayBuffer> result = CompileRun(load).As<v8::ArrayBuffer>(); 21618 v8::Local<v8::ArrayBuffer> result = CompileRun(load).As<v8::ArrayBuffer>();
21611 CHECK_EQ(should_be_neuterable, result->IsNeuterable()); 21619 CHECK_EQ(should_be_neuterable, result->IsNeuterable());
21612 21620
21613 const char* store = 21621 const char* store =
21614 "function Module(stdlib, foreign, heap) {" 21622 "function Module(stdlib, foreign, heap) {"
21615 " 'use asm';" 21623 " 'use asm';"
21616 " var MEM32 = new stdlib.Int32Array(heap);" 21624 " var MEM32 = new stdlib.Int32Array(heap);"
21617 " function store() { MEM32[0] = 0; }" 21625 " function store() { MEM32[0] = 0; }"
21618 " return { store: store };" 21626 " return { store: store };"
21619 "}" 21627 "}"
21620 "var buffer = new ArrayBuffer(4);" 21628 "var buffer = new ArrayBuffer(4);"
21621 "Module(this, {}, buffer).store();" 21629 "Module(this, {}, buffer).store();"
21622 "buffer"; 21630 "buffer";
21623 21631
21632 i::FLAG_turbo_osr = false; // TODO(titzer): test requires eager TF.
21624 result = CompileRun(store).As<v8::ArrayBuffer>(); 21633 result = CompileRun(store).As<v8::ArrayBuffer>();
21625 CHECK_EQ(should_be_neuterable, result->IsNeuterable()); 21634 CHECK_EQ(should_be_neuterable, result->IsNeuterable());
21626 } 21635 }
21627 21636
21628 21637
21629 TEST(GetPrototypeAccessControl) { 21638 TEST(GetPrototypeAccessControl) {
21630 i::FLAG_allow_natives_syntax = true; 21639 i::FLAG_allow_natives_syntax = true;
21631 v8::Isolate* isolate = CcTest::isolate(); 21640 v8::Isolate* isolate = CcTest::isolate();
21632 v8::HandleScope handle_scope(isolate); 21641 v8::HandleScope handle_scope(isolate);
21633 LocalContext env; 21642 LocalContext env;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
21738 } 21747 }
21739 { 21748 {
21740 v8::TryCatch try_catch; 21749 v8::TryCatch try_catch;
21741 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); 21750 uint16_t* data = reinterpret_cast<uint16_t*>(buffer);
21742 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, 21751 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString,
21743 length).IsEmpty()); 21752 length).IsEmpty());
21744 CHECK(!try_catch.HasCaught()); 21753 CHECK(!try_catch.HasCaught());
21745 } 21754 }
21746 free(buffer); 21755 free(buffer);
21747 } 21756 }
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698