Continuing removing deprecated function from cctest
Removes deprecated functions from the following files: test/cctest/test-object-observe.cc test/cctest/test-parsing.cc test/cctest/test-platform.cc test/cctest/test-platform-linux.cc test/cctest/test-platform-win32.cc test/cctest/test-profile-generator.cc test/cctest/test-random-number-generator.cc test/cctest/test-regexp.cc test/cctest/test-reloc-info.cc test/cctest/test-representation.cc test/cctest/test-sampler-api.cc test/cctest/test-serialize.cc test/cctest/test-simd.cc test/cctest/test-slots-buffer.cc test/cctest/test-spaces.cc test/cctest/test-strings.cc test/cctest/test-strtod.cc test/cctest/test-symbols.cc test/cctest/test-threads.cc BUG=v8:4134 LOG=n Review URL: https://codereview.chromium.org/1371363006 Cr-Commit-Position: refs/heads/master@{#31173}
This commit is contained in:
parent
519f215137
commit
6105581e40
@ -38,9 +38,8 @@ namespace internal {
|
||||
class ProfilerExtension : public v8::Extension {
|
||||
public:
|
||||
ProfilerExtension() : v8::Extension("v8/profiler", kSource) { }
|
||||
virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate(
|
||||
v8::Isolate* isolate,
|
||||
v8::Handle<v8::String> name);
|
||||
virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
|
||||
v8::Isolate* isolate, v8::Local<v8::String> name);
|
||||
static void StartProfiling(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static void StopProfiling(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
static v8::CpuProfile* last_profile;
|
||||
|
@ -25,6 +25,9 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include "src/v8.h"
|
||||
|
||||
#include "test/cctest/cctest.h"
|
||||
@ -32,6 +35,11 @@
|
||||
using namespace v8;
|
||||
namespace i = v8::internal;
|
||||
|
||||
inline int32_t ToInt32(v8::Local<v8::Value> value) {
|
||||
return value->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext())
|
||||
.FromJust();
|
||||
}
|
||||
|
||||
|
||||
TEST(PerIsolateState) {
|
||||
HandleScope scope(CcTest::isolate());
|
||||
@ -46,43 +54,53 @@ TEST(PerIsolateState) {
|
||||
"var observer = function(records) { count = records.length; calls++ };"
|
||||
"var obj = {};"
|
||||
"Object.observe(obj, observer);");
|
||||
Handle<Value> observer = CompileRun("observer");
|
||||
Handle<Value> obj = CompileRun("obj");
|
||||
Handle<Value> notify_fun1 = CompileRun(
|
||||
"(function() { obj.foo = 'bar'; })");
|
||||
Handle<Value> notify_fun2;
|
||||
Local<Value> observer = CompileRun("observer");
|
||||
Local<Value> obj = CompileRun("obj");
|
||||
Local<Value> notify_fun1 = CompileRun("(function() { obj.foo = 'bar'; })");
|
||||
Local<Value> notify_fun2;
|
||||
{
|
||||
LocalContext context2(CcTest::isolate());
|
||||
context2->SetSecurityToken(foo);
|
||||
context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"),
|
||||
obj);
|
||||
context2->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
obj)
|
||||
.FromJust();
|
||||
notify_fun2 = CompileRun(
|
||||
"(function() { obj.foo = 'baz'; })");
|
||||
}
|
||||
Handle<Value> notify_fun3;
|
||||
Local<Value> notify_fun3;
|
||||
{
|
||||
LocalContext context3(CcTest::isolate());
|
||||
context3->SetSecurityToken(foo);
|
||||
context3->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"),
|
||||
obj);
|
||||
notify_fun3 = CompileRun(
|
||||
"(function() { obj.foo = 'bat'; })");
|
||||
context3->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
obj)
|
||||
.FromJust();
|
||||
notify_fun3 = CompileRun("(function() { obj.foo = 'bat'; })");
|
||||
}
|
||||
{
|
||||
LocalContext context4(CcTest::isolate());
|
||||
context4->SetSecurityToken(foo);
|
||||
context4->Global()->Set(
|
||||
String::NewFromUtf8(CcTest::isolate(), "observer"), observer);
|
||||
context4->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "fun1"),
|
||||
notify_fun1);
|
||||
context4->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "fun2"),
|
||||
notify_fun2);
|
||||
context4->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "fun3"),
|
||||
notify_fun3);
|
||||
context4->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
v8_str("observer"), observer)
|
||||
.FromJust();
|
||||
context4->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("fun1"),
|
||||
notify_fun1)
|
||||
.FromJust();
|
||||
context4->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("fun2"),
|
||||
notify_fun2)
|
||||
.FromJust();
|
||||
context4->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("fun3"),
|
||||
notify_fun3)
|
||||
.FromJust();
|
||||
CompileRun("fun1(); fun2(); fun3(); Object.deliverChangeRecords(observer)");
|
||||
}
|
||||
CHECK_EQ(1, CompileRun("calls")->Int32Value());
|
||||
CHECK_EQ(3, CompileRun("count")->Int32Value());
|
||||
CHECK_EQ(1, ToInt32(CompileRun("calls")));
|
||||
CHECK_EQ(3, ToInt32(CompileRun("count")));
|
||||
}
|
||||
|
||||
|
||||
@ -95,7 +113,7 @@ TEST(EndOfMicrotaskDelivery) {
|
||||
"var observer = function(records) { count = records.length };"
|
||||
"Object.observe(obj, observer);"
|
||||
"obj.foo = 'bar';");
|
||||
CHECK_EQ(1, CompileRun("count")->Int32Value());
|
||||
CHECK_EQ(1, ToInt32(CompileRun("count")));
|
||||
}
|
||||
|
||||
|
||||
@ -113,20 +131,20 @@ TEST(DeliveryOrdering) {
|
||||
"Object.observe(obj1, observer2);"
|
||||
"Object.observe(obj1, observer3);"
|
||||
"obj1.foo = 'bar';");
|
||||
CHECK_EQ(3, CompileRun("ordering.length")->Int32Value());
|
||||
CHECK_EQ(1, CompileRun("ordering[0]")->Int32Value());
|
||||
CHECK_EQ(2, CompileRun("ordering[1]")->Int32Value());
|
||||
CHECK_EQ(3, CompileRun("ordering[2]")->Int32Value());
|
||||
CHECK_EQ(3, ToInt32(CompileRun("ordering.length")));
|
||||
CHECK_EQ(1, ToInt32(CompileRun("ordering[0]")));
|
||||
CHECK_EQ(2, ToInt32(CompileRun("ordering[1]")));
|
||||
CHECK_EQ(3, ToInt32(CompileRun("ordering[2]")));
|
||||
CompileRun(
|
||||
"ordering = [];"
|
||||
"Object.observe(obj2, observer3);"
|
||||
"Object.observe(obj2, observer2);"
|
||||
"Object.observe(obj2, observer1);"
|
||||
"obj2.foo = 'baz'");
|
||||
CHECK_EQ(3, CompileRun("ordering.length")->Int32Value());
|
||||
CHECK_EQ(1, CompileRun("ordering[0]")->Int32Value());
|
||||
CHECK_EQ(2, CompileRun("ordering[1]")->Int32Value());
|
||||
CHECK_EQ(3, CompileRun("ordering[2]")->Int32Value());
|
||||
CHECK_EQ(3, ToInt32(CompileRun("ordering.length")));
|
||||
CHECK_EQ(1, ToInt32(CompileRun("ordering[0]")));
|
||||
CHECK_EQ(2, ToInt32(CompileRun("ordering[1]")));
|
||||
CHECK_EQ(3, ToInt32(CompileRun("ordering[2]")));
|
||||
}
|
||||
|
||||
|
||||
@ -149,12 +167,12 @@ TEST(DeliveryCallbackThrows) {
|
||||
"Object.observe(obj, observer2);"
|
||||
"Object.observe(obj, observer_throws.bind());"
|
||||
"obj.foo = 'bar';");
|
||||
CHECK_EQ(5, CompileRun("ordering.length")->Int32Value());
|
||||
CHECK_EQ(0, CompileRun("ordering[0]")->Int32Value());
|
||||
CHECK_EQ(1, CompileRun("ordering[1]")->Int32Value());
|
||||
CHECK_EQ(0, CompileRun("ordering[2]")->Int32Value());
|
||||
CHECK_EQ(2, CompileRun("ordering[3]")->Int32Value());
|
||||
CHECK_EQ(0, CompileRun("ordering[4]")->Int32Value());
|
||||
CHECK_EQ(5, ToInt32(CompileRun("ordering.length")));
|
||||
CHECK_EQ(0, ToInt32(CompileRun("ordering[0]")));
|
||||
CHECK_EQ(1, ToInt32(CompileRun("ordering[1]")));
|
||||
CHECK_EQ(0, ToInt32(CompileRun("ordering[2]")));
|
||||
CHECK_EQ(2, ToInt32(CompileRun("ordering[3]")));
|
||||
CHECK_EQ(0, ToInt32(CompileRun("ordering[4]")));
|
||||
}
|
||||
|
||||
|
||||
@ -177,9 +195,9 @@ TEST(DeliveryChangesMutationInCallback) {
|
||||
"Object.observe(obj, observer1);"
|
||||
"Object.observe(obj, observer2);"
|
||||
"obj.foo = 'bar';");
|
||||
CHECK_EQ(2, CompileRun("ordering.length")->Int32Value());
|
||||
CHECK_EQ(101, CompileRun("ordering[0]")->Int32Value());
|
||||
CHECK_EQ(201, CompileRun("ordering[1]")->Int32Value());
|
||||
CHECK_EQ(2, ToInt32(CompileRun("ordering.length")));
|
||||
CHECK_EQ(101, ToInt32(CompileRun("ordering[0]")));
|
||||
CHECK_EQ(201, ToInt32(CompileRun("ordering[1]")));
|
||||
}
|
||||
|
||||
|
||||
@ -203,14 +221,14 @@ TEST(DeliveryOrderingReentrant) {
|
||||
"Object.observe(obj, observer2);"
|
||||
"Object.observe(obj, observer3);"
|
||||
"obj.foo = 'bar';");
|
||||
CHECK_EQ(5, CompileRun("ordering.length")->Int32Value());
|
||||
CHECK_EQ(1, CompileRun("ordering[0]")->Int32Value());
|
||||
CHECK_EQ(2, CompileRun("ordering[1]")->Int32Value());
|
||||
CHECK_EQ(3, CompileRun("ordering[2]")->Int32Value());
|
||||
CHECK_EQ(5, ToInt32(CompileRun("ordering.length")));
|
||||
CHECK_EQ(1, ToInt32(CompileRun("ordering[0]")));
|
||||
CHECK_EQ(2, ToInt32(CompileRun("ordering[1]")));
|
||||
CHECK_EQ(3, ToInt32(CompileRun("ordering[2]")));
|
||||
// Note that we re-deliver to observers 1 and 2, while observer3
|
||||
// already received the second record during the first round.
|
||||
CHECK_EQ(1, CompileRun("ordering[3]")->Int32Value());
|
||||
CHECK_EQ(2, CompileRun("ordering[1]")->Int32Value());
|
||||
CHECK_EQ(1, ToInt32(CompileRun("ordering[3]")));
|
||||
CHECK_EQ(2, ToInt32(CompileRun("ordering[1]")));
|
||||
}
|
||||
|
||||
|
||||
@ -226,15 +244,15 @@ TEST(DeliveryOrderingDeliverChangeRecords) {
|
||||
"Object.observe(obj, observer2);"
|
||||
"obj.a = 1;"
|
||||
"Object.deliverChangeRecords(observer2);");
|
||||
CHECK_EQ(4, CompileRun("ordering.length")->Int32Value());
|
||||
CHECK_EQ(4, ToInt32(CompileRun("ordering.length")));
|
||||
// First, observer2 is called due to deliverChangeRecords
|
||||
CHECK_EQ(2, CompileRun("ordering[0]")->Int32Value());
|
||||
CHECK_EQ(2, ToInt32(CompileRun("ordering[0]")));
|
||||
// Then, observer1 is called when the stack unwinds
|
||||
CHECK_EQ(1, CompileRun("ordering[1]")->Int32Value());
|
||||
CHECK_EQ(1, ToInt32(CompileRun("ordering[1]")));
|
||||
// observer1's mutation causes both 1 and 2 to be reactivated,
|
||||
// with 1 having priority.
|
||||
CHECK_EQ(1, CompileRun("ordering[2]")->Int32Value());
|
||||
CHECK_EQ(2, CompileRun("ordering[3]")->Int32Value());
|
||||
CHECK_EQ(1, ToInt32(CompileRun("ordering[2]")));
|
||||
CHECK_EQ(2, ToInt32(CompileRun("ordering[3]")));
|
||||
}
|
||||
|
||||
|
||||
@ -242,17 +260,21 @@ TEST(ObjectHashTableGrowth) {
|
||||
HandleScope scope(CcTest::isolate());
|
||||
// Initializing this context sets up initial hash tables.
|
||||
LocalContext context(CcTest::isolate());
|
||||
Handle<Value> obj = CompileRun("obj = {};");
|
||||
Handle<Value> observer = CompileRun(
|
||||
Local<Value> obj = CompileRun("obj = {};");
|
||||
Local<Value> observer = CompileRun(
|
||||
"var ran = false;"
|
||||
"(function() { ran = true })");
|
||||
{
|
||||
// As does initializing this context.
|
||||
LocalContext context2(CcTest::isolate());
|
||||
context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"),
|
||||
obj);
|
||||
context2->Global()->Set(
|
||||
String::NewFromUtf8(CcTest::isolate(), "observer"), observer);
|
||||
context2->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
obj)
|
||||
.FromJust();
|
||||
context2->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
v8_str("observer"), observer)
|
||||
.FromJust();
|
||||
CompileRun(
|
||||
"var objArr = [];"
|
||||
// 100 objects should be enough to make the hash table grow
|
||||
@ -265,40 +287,61 @@ TEST(ObjectHashTableGrowth) {
|
||||
}
|
||||
// obj is now marked "is_observed", but our map has moved.
|
||||
CompileRun("obj.foo = 'bar'");
|
||||
CHECK(CompileRun("ran")->BooleanValue());
|
||||
CHECK(CompileRun("ran")
|
||||
->BooleanValue(v8::Isolate::GetCurrent()->GetCurrentContext())
|
||||
.FromJust());
|
||||
}
|
||||
|
||||
|
||||
struct RecordExpectation {
|
||||
Handle<Value> object;
|
||||
Local<Value> object;
|
||||
const char* type;
|
||||
const char* name;
|
||||
Handle<Value> old_value;
|
||||
Local<Value> old_value;
|
||||
};
|
||||
|
||||
|
||||
// TODO(adamk): Use this helper elsewhere in this file.
|
||||
static void ExpectRecords(v8::Isolate* isolate,
|
||||
Handle<Value> records,
|
||||
const RecordExpectation expectations[],
|
||||
int num) {
|
||||
static void ExpectRecords(v8::Isolate* isolate, Local<Value> records,
|
||||
const RecordExpectation expectations[], int num) {
|
||||
CHECK(records->IsArray());
|
||||
Handle<Array> recordArray = records.As<Array>();
|
||||
Local<Array> recordArray = records.As<Array>();
|
||||
CHECK_EQ(num, static_cast<int>(recordArray->Length()));
|
||||
for (int i = 0; i < num; ++i) {
|
||||
Handle<Value> record = recordArray->Get(i);
|
||||
Local<Value> record =
|
||||
recordArray->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), i)
|
||||
.ToLocalChecked();
|
||||
CHECK(record->IsObject());
|
||||
Handle<Object> recordObj = record.As<Object>();
|
||||
CHECK(expectations[i].object->StrictEquals(
|
||||
recordObj->Get(String::NewFromUtf8(isolate, "object"))));
|
||||
CHECK(String::NewFromUtf8(isolate, expectations[i].type)->Equals(
|
||||
recordObj->Get(String::NewFromUtf8(isolate, "type"))));
|
||||
Local<Object> recordObj = record.As<Object>();
|
||||
Local<Value> value =
|
||||
recordObj->Get(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
v8_str("object"))
|
||||
.ToLocalChecked();
|
||||
CHECK(expectations[i].object->StrictEquals(value));
|
||||
value = recordObj->Get(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
v8_str("type"))
|
||||
.ToLocalChecked();
|
||||
CHECK(v8_str(expectations[i].type)
|
||||
->Equals(v8::Isolate::GetCurrent()->GetCurrentContext(), value)
|
||||
.FromJust());
|
||||
if (strcmp("splice", expectations[i].type) != 0) {
|
||||
CHECK(String::NewFromUtf8(isolate, expectations[i].name)->Equals(
|
||||
recordObj->Get(String::NewFromUtf8(isolate, "name"))));
|
||||
Local<Value> name =
|
||||
recordObj->Get(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
v8_str("name"))
|
||||
.ToLocalChecked();
|
||||
CHECK(v8_str(expectations[i].name)
|
||||
->Equals(v8::Isolate::GetCurrent()->GetCurrentContext(), name)
|
||||
.FromJust());
|
||||
if (!expectations[i].old_value.IsEmpty()) {
|
||||
CHECK(expectations[i].old_value->Equals(
|
||||
recordObj->Get(String::NewFromUtf8(isolate, "oldValue"))));
|
||||
Local<Value> old_value =
|
||||
recordObj->Get(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
v8_str("oldValue"))
|
||||
.ToLocalChecked();
|
||||
CHECK(expectations[i]
|
||||
.old_value->Equals(
|
||||
v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
old_value)
|
||||
.FromJust());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -312,44 +355,57 @@ TEST(APITestBasicMutation) {
|
||||
v8::Isolate* v8_isolate = CcTest::isolate();
|
||||
HandleScope scope(v8_isolate);
|
||||
LocalContext context(v8_isolate);
|
||||
Handle<Object> obj = Handle<Object>::Cast(CompileRun(
|
||||
"var records = [];"
|
||||
"var obj = {};"
|
||||
"function observer(r) { [].push.apply(records, r); };"
|
||||
"Object.observe(obj, observer);"
|
||||
"obj"));
|
||||
obj->Set(String::NewFromUtf8(v8_isolate, "foo"),
|
||||
Number::New(v8_isolate, 7));
|
||||
obj->Set(1, Number::New(v8_isolate, 2));
|
||||
// ForceSet should work just as well as Set
|
||||
obj->ForceSet(String::NewFromUtf8(v8_isolate, "foo"),
|
||||
Number::New(v8_isolate, 3));
|
||||
obj->ForceSet(Number::New(v8_isolate, 1), Number::New(v8_isolate, 4));
|
||||
Local<Object> obj = Local<Object>::Cast(
|
||||
CompileRun("var records = [];"
|
||||
"var obj = {};"
|
||||
"function observer(r) { [].push.apply(records, r); };"
|
||||
"Object.observe(obj, observer);"
|
||||
"obj"));
|
||||
obj->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("foo"),
|
||||
Number::New(v8_isolate, 7))
|
||||
.FromJust();
|
||||
obj->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), 1,
|
||||
Number::New(v8_isolate, 2))
|
||||
.FromJust();
|
||||
// CreateDataProperty should work just as well as Set
|
||||
obj->CreateDataProperty(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
v8_str("foo"), Number::New(v8_isolate, 3))
|
||||
.FromJust();
|
||||
obj->CreateDataProperty(v8::Isolate::GetCurrent()->GetCurrentContext(), 1,
|
||||
Number::New(v8_isolate, 4))
|
||||
.FromJust();
|
||||
// Setting an indexed element via the property setting method
|
||||
obj->Set(Number::New(v8_isolate, 1), Number::New(v8_isolate, 5));
|
||||
obj->Set(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
Number::New(v8_isolate, 1), Number::New(v8_isolate, 5))
|
||||
.FromJust();
|
||||
// Setting with a non-String, non-uint32 key
|
||||
obj->Set(Number::New(v8_isolate, 1.1), Number::New(v8_isolate, 6));
|
||||
obj->Delete(String::NewFromUtf8(v8_isolate, "foo"));
|
||||
obj->Delete(1);
|
||||
obj->Delete(Number::New(v8_isolate, 1.1));
|
||||
obj->Set(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
Number::New(v8_isolate, 1.1), Number::New(v8_isolate, 6))
|
||||
.FromJust();
|
||||
obj->Delete(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("foo"))
|
||||
.FromJust();
|
||||
obj->Delete(v8::Isolate::GetCurrent()->GetCurrentContext(), 1).FromJust();
|
||||
obj->Delete(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
Number::New(v8_isolate, 1.1))
|
||||
.FromJust();
|
||||
|
||||
// Force delivery
|
||||
// TODO(adamk): Should the above set methods trigger delivery themselves?
|
||||
CompileRun("void 0");
|
||||
CHECK_EQ(9, CompileRun("records.length")->Int32Value());
|
||||
CHECK_EQ(9, ToInt32(CompileRun("records.length")));
|
||||
const RecordExpectation expected_records[] = {
|
||||
{ obj, "add", "foo", Handle<Value>() },
|
||||
{ obj, "add", "1", Handle<Value>() },
|
||||
// Note: use 7 not 1 below, as the latter triggers a nifty VS10 compiler bug
|
||||
// where instead of 1.0, a garbage value would be passed into Number::New.
|
||||
{ obj, "update", "foo", Number::New(v8_isolate, 7) },
|
||||
{ obj, "update", "1", Number::New(v8_isolate, 2) },
|
||||
{ obj, "update", "1", Number::New(v8_isolate, 4) },
|
||||
{ obj, "add", "1.1", Handle<Value>() },
|
||||
{ obj, "delete", "foo", Number::New(v8_isolate, 3) },
|
||||
{ obj, "delete", "1", Number::New(v8_isolate, 5) },
|
||||
{ obj, "delete", "1.1", Number::New(v8_isolate, 6) }
|
||||
};
|
||||
{obj, "add", "foo", Local<Value>()},
|
||||
{obj, "add", "1", Local<Value>()},
|
||||
// Note: use 7 not 1 below, as the latter triggers a nifty VS10 compiler
|
||||
// bug
|
||||
// where instead of 1.0, a garbage value would be passed into Number::New.
|
||||
{obj, "update", "foo", Number::New(v8_isolate, 7)},
|
||||
{obj, "update", "1", Number::New(v8_isolate, 2)},
|
||||
{obj, "update", "1", Number::New(v8_isolate, 4)},
|
||||
{obj, "add", "1.1", Local<Value>()},
|
||||
{obj, "delete", "foo", Number::New(v8_isolate, 3)},
|
||||
{obj, "delete", "1", Number::New(v8_isolate, 5)},
|
||||
{obj, "delete", "1.1", Number::New(v8_isolate, 6)}};
|
||||
EXPECT_RECORDS(CompileRun("records"), expected_records);
|
||||
}
|
||||
|
||||
@ -358,16 +414,25 @@ TEST(HiddenPrototypeObservation) {
|
||||
v8::Isolate* v8_isolate = CcTest::isolate();
|
||||
HandleScope scope(v8_isolate);
|
||||
LocalContext context(v8_isolate);
|
||||
Handle<FunctionTemplate> tmpl = FunctionTemplate::New(v8_isolate);
|
||||
Local<FunctionTemplate> tmpl = FunctionTemplate::New(v8_isolate);
|
||||
tmpl->SetHiddenPrototype(true);
|
||||
tmpl->InstanceTemplate()->Set(
|
||||
String::NewFromUtf8(v8_isolate, "foo"), Number::New(v8_isolate, 75));
|
||||
Handle<Object> proto = tmpl->GetFunction()->NewInstance();
|
||||
Handle<Object> obj = Object::New(v8_isolate);
|
||||
obj->SetPrototype(proto);
|
||||
context->Global()->Set(String::NewFromUtf8(v8_isolate, "obj"), obj);
|
||||
context->Global()->Set(String::NewFromUtf8(v8_isolate, "proto"),
|
||||
proto);
|
||||
tmpl->InstanceTemplate()->Set(v8_str("foo"), Number::New(v8_isolate, 75));
|
||||
Local<Function> function =
|
||||
tmpl->GetFunction(v8::Isolate::GetCurrent()->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
Local<Object> proto =
|
||||
function->NewInstance(v8::Isolate::GetCurrent()->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
Local<Object> obj = Object::New(v8_isolate);
|
||||
obj->SetPrototype(v8::Isolate::GetCurrent()->GetCurrentContext(), proto)
|
||||
.FromJust();
|
||||
context->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"), obj)
|
||||
.FromJust();
|
||||
context->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("proto"),
|
||||
proto)
|
||||
.FromJust();
|
||||
CompileRun(
|
||||
"var records;"
|
||||
"function observer(r) { records = r; };"
|
||||
@ -378,23 +443,25 @@ TEST(HiddenPrototypeObservation) {
|
||||
{ obj, "update", "foo", Number::New(v8_isolate, 75) }
|
||||
};
|
||||
EXPECT_RECORDS(CompileRun("records"), expected_records);
|
||||
obj->SetPrototype(Null(v8_isolate));
|
||||
obj->SetPrototype(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
Null(v8_isolate))
|
||||
.FromJust();
|
||||
CompileRun("obj.foo = 43");
|
||||
const RecordExpectation expected_records2[] = {
|
||||
{ obj, "add", "foo", Handle<Value>() }
|
||||
};
|
||||
{obj, "add", "foo", Local<Value>()}};
|
||||
EXPECT_RECORDS(CompileRun("records"), expected_records2);
|
||||
obj->SetPrototype(proto);
|
||||
obj->SetPrototype(v8::Isolate::GetCurrent()->GetCurrentContext(), proto)
|
||||
.FromJust();
|
||||
CompileRun(
|
||||
"Object.observe(proto, observer);"
|
||||
"proto.bar = 1;"
|
||||
"Object.unobserve(obj, observer);"
|
||||
"obj.foo = 44;");
|
||||
const RecordExpectation expected_records3[] = {
|
||||
{ proto, "add", "bar", Handle<Value>() }
|
||||
// TODO(adamk): The below record should be emitted since proto is observed
|
||||
// and has been modified. Not clear if this happens in practice.
|
||||
// { proto, "update", "foo", Number::New(43) }
|
||||
{proto, "add", "bar", Local<Value>()}
|
||||
// TODO(adamk): The below record should be emitted since proto is observed
|
||||
// and has been modified. Not clear if this happens in practice.
|
||||
// { proto, "update", "foo", Number::New(43) }
|
||||
};
|
||||
EXPECT_RECORDS(CompileRun("records"), expected_records3);
|
||||
}
|
||||
@ -436,27 +503,31 @@ TEST(ObservationWeakMap) {
|
||||
}
|
||||
|
||||
|
||||
static int TestObserveSecurity(Handle<Context> observer_context,
|
||||
Handle<Context> object_context,
|
||||
Handle<Context> mutation_context) {
|
||||
static int TestObserveSecurity(Local<Context> observer_context,
|
||||
Local<Context> object_context,
|
||||
Local<Context> mutation_context) {
|
||||
Context::Scope observer_scope(observer_context);
|
||||
CompileRun("var records = null;"
|
||||
"var observer = function(r) { records = r };");
|
||||
Handle<Value> observer = CompileRun("observer");
|
||||
Local<Value> observer = CompileRun("observer");
|
||||
{
|
||||
Context::Scope object_scope(object_context);
|
||||
object_context->Global()->Set(
|
||||
String::NewFromUtf8(CcTest::isolate(), "observer"), observer);
|
||||
object_context->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
v8_str("observer"), observer)
|
||||
.FromJust();
|
||||
CompileRun("var obj = {};"
|
||||
"obj.length = 0;"
|
||||
"Object.observe(obj, observer,"
|
||||
"['add', 'update', 'delete','reconfigure','splice']"
|
||||
");");
|
||||
Handle<Value> obj = CompileRun("obj");
|
||||
Local<Value> obj = CompileRun("obj");
|
||||
{
|
||||
Context::Scope mutation_scope(mutation_context);
|
||||
mutation_context->Global()->Set(
|
||||
String::NewFromUtf8(CcTest::isolate(), "obj"), obj);
|
||||
mutation_context->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
obj)
|
||||
.FromJust();
|
||||
CompileRun("obj.foo = 'bar';"
|
||||
"obj.foo = 'baz';"
|
||||
"delete obj.foo;"
|
||||
@ -467,7 +538,7 @@ static int TestObserveSecurity(Handle<Context> observer_context,
|
||||
"Array.prototype.shift.call(obj);");
|
||||
}
|
||||
}
|
||||
return CompileRun("records ? records.length : 0")->Int32Value();
|
||||
return ToInt32(CompileRun("records ? records.length : 0"));
|
||||
}
|
||||
|
||||
|
||||
@ -580,11 +651,14 @@ TEST(ObserverSecurityNotify) {
|
||||
"var recordsA = null;"
|
||||
"var observerA = function(r) { recordsA = r };"
|
||||
"Object.observe(obj, observerA);");
|
||||
Handle<Value> obj = CompileRun("obj");
|
||||
Local<Value> obj = CompileRun("obj");
|
||||
|
||||
{
|
||||
Context::Scope scopeB(contextB);
|
||||
contextB->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"), obj);
|
||||
contextB->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
obj)
|
||||
.FromJust();
|
||||
CompileRun("var recordsB = null;"
|
||||
"var observerB = function(r) { recordsB = r };"
|
||||
"Object.observe(obj, observerB);");
|
||||
@ -592,11 +666,11 @@ TEST(ObserverSecurityNotify) {
|
||||
|
||||
CompileRun("var notifier = Object.getNotifier(obj);"
|
||||
"notifier.notify({ type: 'update' });");
|
||||
CHECK_EQ(1, CompileRun("recordsA ? recordsA.length : 0")->Int32Value());
|
||||
CHECK_EQ(1, ToInt32(CompileRun("recordsA ? recordsA.length : 0")));
|
||||
|
||||
{
|
||||
Context::Scope scopeB(contextB);
|
||||
CHECK_EQ(0, CompileRun("recordsB ? recordsB.length : 0")->Int32Value());
|
||||
CHECK_EQ(0, ToInt32(CompileRun("recordsB ? recordsB.length : 0")));
|
||||
}
|
||||
}
|
||||
|
||||
@ -608,11 +682,12 @@ TEST(HiddenPropertiesLeakage) {
|
||||
"var records = null;"
|
||||
"var observer = function(r) { records = r };"
|
||||
"Object.observe(obj, observer);");
|
||||
Handle<Value> obj =
|
||||
context->Global()->Get(String::NewFromUtf8(CcTest::isolate(), "obj"));
|
||||
Handle<Object>::Cast(obj)
|
||||
->SetHiddenValue(String::NewFromUtf8(CcTest::isolate(), "foo"),
|
||||
Null(CcTest::isolate()));
|
||||
Local<Value> obj =
|
||||
context->Global()
|
||||
->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"))
|
||||
.ToLocalChecked();
|
||||
Local<Object>::Cast(obj)
|
||||
->SetHiddenValue(v8_str("foo"), Null(CcTest::isolate()));
|
||||
CompileRun(""); // trigger delivery
|
||||
CHECK(CompileRun("records")->IsNull());
|
||||
}
|
||||
@ -622,11 +697,13 @@ TEST(GetNotifierFromOtherContext) {
|
||||
HandleScope scope(CcTest::isolate());
|
||||
LocalContext context(CcTest::isolate());
|
||||
CompileRun("var obj = {};");
|
||||
Handle<Value> instance = CompileRun("obj");
|
||||
Local<Value> instance = CompileRun("obj");
|
||||
{
|
||||
LocalContext context2(CcTest::isolate());
|
||||
context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"),
|
||||
instance);
|
||||
context2->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
instance)
|
||||
.FromJust();
|
||||
CHECK(CompileRun("Object.getNotifier(obj)")->IsNull());
|
||||
}
|
||||
}
|
||||
@ -634,17 +711,19 @@ TEST(GetNotifierFromOtherContext) {
|
||||
|
||||
TEST(GetNotifierFromOtherOrigin) {
|
||||
HandleScope scope(CcTest::isolate());
|
||||
Handle<Value> foo = String::NewFromUtf8(CcTest::isolate(), "foo");
|
||||
Handle<Value> bar = String::NewFromUtf8(CcTest::isolate(), "bar");
|
||||
Local<Value> foo = v8_str("foo");
|
||||
Local<Value> bar = v8_str("bar");
|
||||
LocalContext context(CcTest::isolate());
|
||||
context->SetSecurityToken(foo);
|
||||
CompileRun("var obj = {};");
|
||||
Handle<Value> instance = CompileRun("obj");
|
||||
Local<Value> instance = CompileRun("obj");
|
||||
{
|
||||
LocalContext context2(CcTest::isolate());
|
||||
context2->SetSecurityToken(bar);
|
||||
context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"),
|
||||
instance);
|
||||
context2->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
instance)
|
||||
.FromJust();
|
||||
CHECK(CompileRun("Object.getNotifier(obj)")->IsNull());
|
||||
}
|
||||
}
|
||||
@ -652,16 +731,18 @@ TEST(GetNotifierFromOtherOrigin) {
|
||||
|
||||
TEST(GetNotifierFromSameOrigin) {
|
||||
HandleScope scope(CcTest::isolate());
|
||||
Handle<Value> foo = String::NewFromUtf8(CcTest::isolate(), "foo");
|
||||
Local<Value> foo = v8_str("foo");
|
||||
LocalContext context(CcTest::isolate());
|
||||
context->SetSecurityToken(foo);
|
||||
CompileRun("var obj = {};");
|
||||
Handle<Value> instance = CompileRun("obj");
|
||||
Local<Value> instance = CompileRun("obj");
|
||||
{
|
||||
LocalContext context2(CcTest::isolate());
|
||||
context2->SetSecurityToken(foo);
|
||||
context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"),
|
||||
instance);
|
||||
context2->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
instance)
|
||||
.FromJust();
|
||||
CHECK(CompileRun("Object.getNotifier(obj)")->IsObject());
|
||||
}
|
||||
}
|
||||
@ -694,17 +775,19 @@ static void CheckSurvivingGlobalObjectsCount(int expected) {
|
||||
|
||||
TEST(DontLeakContextOnObserve) {
|
||||
HandleScope scope(CcTest::isolate());
|
||||
Handle<Value> foo = String::NewFromUtf8(CcTest::isolate(), "foo");
|
||||
Local<Value> foo = v8_str("foo");
|
||||
LocalContext context(CcTest::isolate());
|
||||
context->SetSecurityToken(foo);
|
||||
CompileRun("var obj = {};");
|
||||
Handle<Value> object = CompileRun("obj");
|
||||
Local<Value> object = CompileRun("obj");
|
||||
{
|
||||
HandleScope scope(CcTest::isolate());
|
||||
LocalContext context2(CcTest::isolate());
|
||||
context2->SetSecurityToken(foo);
|
||||
context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"),
|
||||
object);
|
||||
context2->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
object)
|
||||
.FromJust();
|
||||
CompileRun("function observer() {};"
|
||||
"Object.observe(obj, observer, ['foo', 'bar', 'baz']);"
|
||||
"Object.unobserve(obj, observer);");
|
||||
@ -717,17 +800,19 @@ TEST(DontLeakContextOnObserve) {
|
||||
|
||||
TEST(DontLeakContextOnGetNotifier) {
|
||||
HandleScope scope(CcTest::isolate());
|
||||
Handle<Value> foo = String::NewFromUtf8(CcTest::isolate(), "foo");
|
||||
Local<Value> foo = v8_str("foo");
|
||||
LocalContext context(CcTest::isolate());
|
||||
context->SetSecurityToken(foo);
|
||||
CompileRun("var obj = {};");
|
||||
Handle<Value> object = CompileRun("obj");
|
||||
Local<Value> object = CompileRun("obj");
|
||||
{
|
||||
HandleScope scope(CcTest::isolate());
|
||||
LocalContext context2(CcTest::isolate());
|
||||
context2->SetSecurityToken(foo);
|
||||
context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"),
|
||||
object);
|
||||
context2->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
object)
|
||||
.FromJust();
|
||||
CompileRun("Object.getNotifier(obj);");
|
||||
}
|
||||
|
||||
@ -738,20 +823,24 @@ TEST(DontLeakContextOnGetNotifier) {
|
||||
|
||||
TEST(DontLeakContextOnNotifierPerformChange) {
|
||||
HandleScope scope(CcTest::isolate());
|
||||
Handle<Value> foo = String::NewFromUtf8(CcTest::isolate(), "foo");
|
||||
Local<Value> foo = v8_str("foo");
|
||||
LocalContext context(CcTest::isolate());
|
||||
context->SetSecurityToken(foo);
|
||||
CompileRun("var obj = {};");
|
||||
Handle<Value> object = CompileRun("obj");
|
||||
Handle<Value> notifier = CompileRun("Object.getNotifier(obj)");
|
||||
Local<Value> object = CompileRun("obj");
|
||||
Local<Value> notifier = CompileRun("Object.getNotifier(obj)");
|
||||
{
|
||||
HandleScope scope(CcTest::isolate());
|
||||
LocalContext context2(CcTest::isolate());
|
||||
context2->SetSecurityToken(foo);
|
||||
context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "obj"),
|
||||
object);
|
||||
context2->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "notifier"),
|
||||
notifier);
|
||||
context2->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
object)
|
||||
.FromJust();
|
||||
context2->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
v8_str("notifier"), notifier)
|
||||
.FromJust();
|
||||
CompileRun("var obj2 = {};"
|
||||
"var notifier2 = Object.getNotifier(obj2);"
|
||||
"notifier2.performChange.call("
|
||||
@ -764,8 +853,8 @@ TEST(DontLeakContextOnNotifierPerformChange) {
|
||||
|
||||
|
||||
static void ObserverCallback(const FunctionCallbackInfo<Value>& args) {
|
||||
*static_cast<int*>(Handle<External>::Cast(args.Data())->Value()) =
|
||||
Handle<Array>::Cast(args[0])->Length();
|
||||
*static_cast<int*>(Local<External>::Cast(args.Data())->Value()) =
|
||||
Local<Array>::Cast(args[0])->Length();
|
||||
}
|
||||
|
||||
|
||||
@ -774,11 +863,14 @@ TEST(ObjectObserveCallsCppFunction) {
|
||||
HandleScope scope(isolate);
|
||||
LocalContext context(isolate);
|
||||
int numRecordsSent = 0;
|
||||
Handle<Function> observer =
|
||||
Function::New(CcTest::isolate(), ObserverCallback,
|
||||
External::New(isolate, &numRecordsSent));
|
||||
context->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "observer"),
|
||||
observer);
|
||||
Local<Function> observer =
|
||||
Function::New(CcTest::isolate()->GetCurrentContext(), ObserverCallback,
|
||||
External::New(isolate, &numRecordsSent))
|
||||
.ToLocalChecked();
|
||||
context->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("observer"),
|
||||
observer)
|
||||
.FromJust();
|
||||
CompileRun(
|
||||
"var obj = {};"
|
||||
"Object.observe(obj, observer);"
|
||||
@ -793,10 +885,15 @@ TEST(ObjectObserveCallsFunctionTemplateInstance) {
|
||||
HandleScope scope(isolate);
|
||||
LocalContext context(isolate);
|
||||
int numRecordsSent = 0;
|
||||
Handle<FunctionTemplate> tmpl = FunctionTemplate::New(
|
||||
Local<FunctionTemplate> tmpl = FunctionTemplate::New(
|
||||
isolate, ObserverCallback, External::New(isolate, &numRecordsSent));
|
||||
context->Global()->Set(String::NewFromUtf8(CcTest::isolate(), "observer"),
|
||||
tmpl->GetFunction());
|
||||
Local<Function> function =
|
||||
tmpl->GetFunction(v8::Isolate::GetCurrent()->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
context->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("observer"),
|
||||
function)
|
||||
.FromJust();
|
||||
CompileRun(
|
||||
"var obj = {};"
|
||||
"Object.observe(obj, observer);"
|
||||
@ -806,13 +903,13 @@ TEST(ObjectObserveCallsFunctionTemplateInstance) {
|
||||
}
|
||||
|
||||
|
||||
static void AccessorGetter(Local<String> property,
|
||||
static void AccessorGetter(Local<Name> property,
|
||||
const PropertyCallbackInfo<Value>& info) {
|
||||
info.GetReturnValue().Set(Integer::New(info.GetIsolate(), 42));
|
||||
}
|
||||
|
||||
|
||||
static void AccessorSetter(Local<String> property, Local<Value> value,
|
||||
static void AccessorSetter(Local<Name> property, Local<Value> value,
|
||||
const PropertyCallbackInfo<void>& info) {
|
||||
info.GetReturnValue().SetUndefined();
|
||||
}
|
||||
@ -822,10 +919,14 @@ TEST(APIAccessorsShouldNotNotify) {
|
||||
Isolate* isolate = CcTest::isolate();
|
||||
HandleScope handle_scope(isolate);
|
||||
LocalContext context(isolate);
|
||||
Handle<Object> object = Object::New(isolate);
|
||||
object->SetAccessor(String::NewFromUtf8(isolate, "accessor"), &AccessorGetter,
|
||||
&AccessorSetter);
|
||||
context->Global()->Set(String::NewFromUtf8(isolate, "obj"), object);
|
||||
Local<Object> object = Object::New(isolate);
|
||||
object->SetAccessor(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
v8_str("accessor"), &AccessorGetter, &AccessorSetter)
|
||||
.FromJust();
|
||||
context->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
object)
|
||||
.FromJust();
|
||||
CompileRun(
|
||||
"var records = null;"
|
||||
"Object.observe(obj, function(r) { records = r });"
|
||||
@ -902,7 +1003,14 @@ TEST(DisallowObserveAccessCheckedObject) {
|
||||
v8::Local<v8::ObjectTemplate> object_template =
|
||||
v8::ObjectTemplate::New(isolate);
|
||||
object_template->SetAccessCheckCallbacks(NamedAccessCheckAlwaysAllow, NULL);
|
||||
env->Global()->Set(v8_str("obj"), object_template->NewInstance());
|
||||
Local<Object> new_instance =
|
||||
object_template->NewInstance(
|
||||
v8::Isolate::GetCurrent()->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
env->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
new_instance)
|
||||
.FromJust();
|
||||
v8::TryCatch try_catch(isolate);
|
||||
CompileRun("Object.observe(obj, function(){})");
|
||||
CHECK(try_catch.HasCaught());
|
||||
@ -916,7 +1024,14 @@ TEST(DisallowGetNotifierAccessCheckedObject) {
|
||||
v8::Local<v8::ObjectTemplate> object_template =
|
||||
v8::ObjectTemplate::New(isolate);
|
||||
object_template->SetAccessCheckCallbacks(NamedAccessCheckAlwaysAllow, NULL);
|
||||
env->Global()->Set(v8_str("obj"), object_template->NewInstance());
|
||||
Local<Object> new_instance =
|
||||
object_template->NewInstance(
|
||||
v8::Isolate::GetCurrent()->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
env->Global()
|
||||
->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), v8_str("obj"),
|
||||
new_instance)
|
||||
.FromJust();
|
||||
v8::TryCatch try_catch(isolate);
|
||||
CompileRun("Object.getNotifier(obj)");
|
||||
CHECK(try_catch.HasCaught());
|
||||
|
@ -25,6 +25,9 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -225,21 +228,26 @@ TEST(UsingCachedData) {
|
||||
int source_length = i::StrLength(source);
|
||||
|
||||
// ScriptResource will be deleted when the corresponding String is GCd.
|
||||
v8::ScriptCompiler::Source script_source(v8::String::NewExternal(
|
||||
isolate, new ScriptResource(source, source_length)));
|
||||
v8::ScriptCompiler::Source script_source(
|
||||
v8::String::NewExternalOneByte(isolate,
|
||||
new ScriptResource(source, source_length))
|
||||
.ToLocalChecked());
|
||||
i::FLAG_min_preparse_length = 0;
|
||||
v8::ScriptCompiler::Compile(isolate, &script_source,
|
||||
v8::ScriptCompiler::kProduceParserCache);
|
||||
v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &script_source,
|
||||
v8::ScriptCompiler::kProduceParserCache)
|
||||
.ToLocalChecked();
|
||||
CHECK(script_source.GetCachedData());
|
||||
|
||||
// Compile the script again, using the cached data.
|
||||
bool lazy_flag = i::FLAG_lazy;
|
||||
i::FLAG_lazy = true;
|
||||
v8::ScriptCompiler::Compile(isolate, &script_source,
|
||||
v8::ScriptCompiler::kConsumeParserCache);
|
||||
v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &script_source,
|
||||
v8::ScriptCompiler::kConsumeParserCache)
|
||||
.ToLocalChecked();
|
||||
i::FLAG_lazy = false;
|
||||
v8::ScriptCompiler::CompileUnbound(isolate, &script_source,
|
||||
v8::ScriptCompiler::kConsumeParserCache);
|
||||
v8::ScriptCompiler::CompileUnboundScript(
|
||||
isolate, &script_source, v8::ScriptCompiler::kConsumeParserCache)
|
||||
.ToLocalChecked();
|
||||
i::FLAG_lazy = lazy_flag;
|
||||
}
|
||||
|
||||
@ -271,8 +279,9 @@ TEST(PreparseFunctionDataIsUsed) {
|
||||
|
||||
for (unsigned i = 0; i < arraysize(good_code); i++) {
|
||||
v8::ScriptCompiler::Source good_source(v8_str(good_code[i]));
|
||||
v8::ScriptCompiler::Compile(isolate, &good_source,
|
||||
v8::ScriptCompiler::kProduceParserCache);
|
||||
v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &good_source,
|
||||
v8::ScriptCompiler::kProduceParserCache)
|
||||
.ToLocalChecked();
|
||||
|
||||
const v8::ScriptCompiler::CachedData* cached_data =
|
||||
good_source.GetCachedData();
|
||||
@ -286,11 +295,10 @@ TEST(PreparseFunctionDataIsUsed) {
|
||||
v8_str(bad_code[i]), new v8::ScriptCompiler::CachedData(
|
||||
cached_data->data, cached_data->length));
|
||||
v8::Local<v8::Value> result =
|
||||
v8::ScriptCompiler::Compile(isolate, &bad_source,
|
||||
v8::ScriptCompiler::kConsumeParserCache)
|
||||
->Run();
|
||||
CompileRun(isolate->GetCurrentContext(), &bad_source,
|
||||
v8::ScriptCompiler::kConsumeParserCache);
|
||||
CHECK(result->IsInt32());
|
||||
CHECK_EQ(25, result->Int32Value());
|
||||
CHECK_EQ(25, result->Int32Value(isolate->GetCurrentContext()).FromJust());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1034,7 +1042,7 @@ TEST(ScopeUsesArgumentsSuperThis) {
|
||||
i::Factory* factory = isolate->factory();
|
||||
|
||||
v8::HandleScope handles(CcTest::isolate());
|
||||
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(context);
|
||||
|
||||
isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
|
||||
@ -1339,7 +1347,7 @@ TEST(ScopePositions) {
|
||||
i::Factory* factory = isolate->factory();
|
||||
|
||||
v8::HandleScope handles(CcTest::isolate());
|
||||
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(context);
|
||||
|
||||
isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
|
||||
@ -1474,8 +1482,7 @@ i::Handle<i::String> FormatMessage(i::Vector<unsigned> data) {
|
||||
// length field content words.
|
||||
const char* arg =
|
||||
ReadString(&data[i::PreparseDataConstants::kMessageArgPos]);
|
||||
arg_object =
|
||||
v8::Utils::OpenHandle(*v8::String::NewFromUtf8(CcTest::isolate(), arg));
|
||||
arg_object = v8::Utils::OpenHandle(*v8_str(arg));
|
||||
i::DeleteArray(arg);
|
||||
} else {
|
||||
CHECK_EQ(0, arg_count);
|
||||
@ -1753,7 +1760,7 @@ TEST(ParserSync) {
|
||||
};
|
||||
|
||||
v8::HandleScope handles(CcTest::isolate());
|
||||
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(context);
|
||||
|
||||
CcTest::i_isolate()->stack_guard()->SetStackLimit(
|
||||
@ -1809,7 +1816,7 @@ TEST(StrictOctal) {
|
||||
" 01; \n"
|
||||
" }; \n"
|
||||
"}; \n";
|
||||
v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script));
|
||||
v8_compile(v8_str(script));
|
||||
CHECK(try_catch.HasCaught());
|
||||
v8::String::Utf8Value exception(try_catch.Exception());
|
||||
CHECK_EQ(0,
|
||||
@ -1828,7 +1835,7 @@ void RunParserSyncTest(const char* context_data[][2],
|
||||
const ParserFlag* always_false_flags = NULL,
|
||||
int always_false_len = 0) {
|
||||
v8::HandleScope handles(CcTest::isolate());
|
||||
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(context);
|
||||
|
||||
CcTest::i_isolate()->stack_guard()->SetStackLimit(
|
||||
@ -3197,12 +3204,16 @@ TEST(FuncNameInferrerTwoByte) {
|
||||
// Make it really non-Latin1 (replace the Xs with a non-Latin1 character).
|
||||
two_byte_source[14] = two_byte_source[78] = two_byte_name[6] = 0x010d;
|
||||
v8::Local<v8::String> source =
|
||||
v8::String::NewFromTwoByte(isolate, two_byte_source);
|
||||
v8::String::NewFromTwoByte(isolate, two_byte_source,
|
||||
v8::NewStringType::kNormal)
|
||||
.ToLocalChecked();
|
||||
v8::Local<v8::Value> result = CompileRun(source);
|
||||
CHECK(result->IsString());
|
||||
v8::Local<v8::String> expected_name =
|
||||
v8::String::NewFromTwoByte(isolate, two_byte_name);
|
||||
CHECK(result->Equals(expected_name));
|
||||
v8::String::NewFromTwoByte(isolate, two_byte_name,
|
||||
v8::NewStringType::kNormal)
|
||||
.ToLocalChecked();
|
||||
CHECK(result->Equals(isolate->GetCurrentContext(), expected_name).FromJust());
|
||||
i::DeleteArray(two_byte_source);
|
||||
i::DeleteArray(two_byte_name);
|
||||
}
|
||||
@ -3222,12 +3233,16 @@ TEST(FuncNameInferrerEscaped) {
|
||||
// Fix to correspond to the non-ASCII name in two_byte_source.
|
||||
two_byte_name[6] = 0x010d;
|
||||
v8::Local<v8::String> source =
|
||||
v8::String::NewFromTwoByte(isolate, two_byte_source);
|
||||
v8::String::NewFromTwoByte(isolate, two_byte_source,
|
||||
v8::NewStringType::kNormal)
|
||||
.ToLocalChecked();
|
||||
v8::Local<v8::Value> result = CompileRun(source);
|
||||
CHECK(result->IsString());
|
||||
v8::Local<v8::String> expected_name =
|
||||
v8::String::NewFromTwoByte(isolate, two_byte_name);
|
||||
CHECK(result->Equals(expected_name));
|
||||
v8::String::NewFromTwoByte(isolate, two_byte_name,
|
||||
v8::NewStringType::kNormal)
|
||||
.ToLocalChecked();
|
||||
CHECK(result->Equals(isolate->GetCurrentContext(), expected_name).FromJust());
|
||||
i::DeleteArray(two_byte_source);
|
||||
i::DeleteArray(two_byte_name);
|
||||
}
|
||||
@ -5491,7 +5506,7 @@ TEST(BasicImportExportParsing) {
|
||||
i::Factory* factory = isolate->factory();
|
||||
|
||||
v8::HandleScope handles(CcTest::isolate());
|
||||
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(context);
|
||||
|
||||
isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
|
||||
@ -5608,7 +5623,7 @@ TEST(ImportExportParsingErrors) {
|
||||
i::Factory* factory = isolate->factory();
|
||||
|
||||
v8::HandleScope handles(CcTest::isolate());
|
||||
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(context);
|
||||
|
||||
isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
|
||||
@ -5634,7 +5649,7 @@ TEST(ModuleParsingInternals) {
|
||||
i::Isolate* isolate = CcTest::i_isolate();
|
||||
i::Factory* factory = isolate->factory();
|
||||
v8::HandleScope handles(CcTest::isolate());
|
||||
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(context);
|
||||
isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
|
||||
128 * 1024);
|
||||
@ -5766,7 +5781,7 @@ void TestLanguageMode(const char* source,
|
||||
i::Isolate* isolate = CcTest::i_isolate();
|
||||
i::Factory* factory = isolate->factory();
|
||||
v8::HandleScope handles(CcTest::isolate());
|
||||
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(context);
|
||||
isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
|
||||
128 * 1024);
|
||||
@ -6454,7 +6469,7 @@ TEST(StrongModeFreeVariablesNotDeclared) {
|
||||
" not_there2; \n"
|
||||
"} \n";
|
||||
v8::TryCatch try_catch2(CcTest::isolate());
|
||||
v8::Script::Compile(v8_str(script2));
|
||||
v8_compile(v8_str(script2));
|
||||
CHECK(try_catch2.HasCaught());
|
||||
v8::String::Utf8Value exception(try_catch2.Exception());
|
||||
CHECK_EQ(0,
|
||||
@ -6475,7 +6490,7 @@ TEST(StrongModeFreeVariablesNotDeclared) {
|
||||
" } \n"
|
||||
"})(); \n";
|
||||
v8::TryCatch try_catch2(CcTest::isolate());
|
||||
v8::Script::Compile(v8_str(script3));
|
||||
v8_compile(v8_str(script3));
|
||||
CHECK(try_catch2.HasCaught());
|
||||
v8::String::Utf8Value exception(try_catch2.Exception());
|
||||
CHECK_EQ(0,
|
||||
|
@ -27,6 +27,9 @@
|
||||
//
|
||||
// Tests of the TokenLock class from lock.h
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h> // for usleep()
|
||||
|
@ -27,6 +27,9 @@
|
||||
//
|
||||
// Tests of the TokenLock class from lock.h
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "src/v8.h"
|
||||
|
@ -2,6 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include <stdint.h>
|
||||
#include "src/base/build_config.h"
|
||||
#include "src/base/platform/platform.h"
|
||||
@ -40,7 +43,7 @@ void GetStackPointer(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
TEST(StackAlignment) {
|
||||
v8::Isolate* isolate = CcTest::isolate();
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::Handle<v8::ObjectTemplate> global_template =
|
||||
v8::Local<v8::ObjectTemplate> global_template =
|
||||
v8::ObjectTemplate::New(isolate);
|
||||
global_template->Set(v8_str("get_stack_pointer"),
|
||||
v8::FunctionTemplate::New(isolate, GetStackPointer));
|
||||
@ -52,12 +55,15 @@ TEST(StackAlignment) {
|
||||
"}");
|
||||
|
||||
v8::Local<v8::Object> global_object = env->Global();
|
||||
v8::Local<v8::Function> foo =
|
||||
v8::Local<v8::Function>::Cast(global_object->Get(v8_str("foo")));
|
||||
v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
|
||||
global_object->Get(isolate->GetCurrentContext(), v8_str("foo"))
|
||||
.ToLocalChecked());
|
||||
|
||||
v8::Local<v8::Value> result = foo->Call(global_object, 0, NULL);
|
||||
CHECK_EQ(0u,
|
||||
result->Uint32Value() % v8::base::OS::ActivationFrameAlignment());
|
||||
v8::Local<v8::Value> result =
|
||||
foo->Call(isolate->GetCurrentContext(), global_object, 0, NULL)
|
||||
.ToLocalChecked();
|
||||
CHECK_EQ(0u, result->Uint32Value(isolate->GetCurrentContext()).FromJust() %
|
||||
v8::base::OS::ActivationFrameAlignment());
|
||||
}
|
||||
|
||||
#endif // V8_CC_GNU
|
||||
|
@ -27,6 +27,9 @@
|
||||
//
|
||||
// Tests of profiles generator and utilities.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include "src/v8.h"
|
||||
|
||||
#include "include/v8-profiler.h"
|
||||
@ -577,15 +580,16 @@ TEST(ProfileNodeScriptId) {
|
||||
v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler();
|
||||
i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler);
|
||||
CHECK_EQ(0, iprofiler->GetProfilesCount());
|
||||
v8::Handle<v8::Script> script_a = v8::Script::Compile(v8::String::NewFromUtf8(
|
||||
env->GetIsolate(), "function a() { startProfiling(); }\n"));
|
||||
script_a->Run();
|
||||
v8::Handle<v8::Script> script_b =
|
||||
v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
|
||||
"function b() { a(); }\n"
|
||||
"b();\n"
|
||||
"stopProfiling();\n"));
|
||||
script_b->Run();
|
||||
v8::Local<v8::Script> script_a =
|
||||
v8_compile(v8_str("function a() { startProfiling(); }\n"));
|
||||
script_a->Run(v8::Isolate::GetCurrent()->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
v8::Local<v8::Script> script_b =
|
||||
v8_compile(v8_str("function b() { a(); }\n"
|
||||
"b();\n"
|
||||
"stopProfiling();\n"));
|
||||
script_b->Run(v8::Isolate::GetCurrent()->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
CHECK_EQ(1, iprofiler->GetProfilesCount());
|
||||
const v8::CpuProfile* profile = i::ProfilerExtension::last_profile;
|
||||
const v8::CpuProfileNode* current = profile->GetTopDownRoot();
|
||||
@ -632,9 +636,13 @@ static const char* line_number_test_source_profile_time_functions =
|
||||
int GetFunctionLineNumber(LocalContext* env, const char* name) {
|
||||
CpuProfiler* profiler = CcTest::i_isolate()->cpu_profiler();
|
||||
CodeMap* code_map = profiler->generator()->code_map();
|
||||
i::Handle<i::JSFunction> func = v8::Utils::OpenHandle(
|
||||
*v8::Local<v8::Function>::Cast(
|
||||
(*(*env))->Global()->Get(v8_str(name))));
|
||||
i::Handle<i::JSFunction> func =
|
||||
v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
|
||||
(*(*env))
|
||||
->Global()
|
||||
->Get(v8::Isolate::GetCurrent()->GetCurrentContext(),
|
||||
v8_str(name))
|
||||
.ToLocalChecked()));
|
||||
CodeEntry* func_entry = code_map->FindEntry(func->code()->address());
|
||||
if (!func_entry)
|
||||
FATAL(name);
|
||||
@ -679,20 +687,19 @@ TEST(BailoutReason) {
|
||||
v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler();
|
||||
i::CpuProfiler* iprofiler = reinterpret_cast<i::CpuProfiler*>(profiler);
|
||||
CHECK_EQ(0, iprofiler->GetProfilesCount());
|
||||
v8::Handle<v8::Script> script =
|
||||
v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
|
||||
"function Debugger() {\n"
|
||||
" debugger;\n"
|
||||
" startProfiling();\n"
|
||||
"}\n"
|
||||
"function TryFinally() {\n"
|
||||
" try {\n"
|
||||
" Debugger();\n"
|
||||
" } finally { };\n"
|
||||
"}\n"
|
||||
"TryFinally();\n"
|
||||
"stopProfiling();"));
|
||||
script->Run();
|
||||
v8::Local<v8::Script> script =
|
||||
v8_compile(v8_str("function Debugger() {\n"
|
||||
" debugger;\n"
|
||||
" startProfiling();\n"
|
||||
"}\n"
|
||||
"function TryFinally() {\n"
|
||||
" try {\n"
|
||||
" Debugger();\n"
|
||||
" } finally { };\n"
|
||||
"}\n"
|
||||
"TryFinally();\n"
|
||||
"stopProfiling();"));
|
||||
script->Run(v8::Isolate::GetCurrent()->GetCurrentContext()).ToLocalChecked();
|
||||
CHECK_EQ(1, iprofiler->GetProfilesCount());
|
||||
const v8::CpuProfile* profile = i::ProfilerExtension::last_profile;
|
||||
CHECK(profile);
|
||||
|
@ -25,6 +25,9 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include "src/v8.h"
|
||||
#include "test/cctest/cctest.h"
|
||||
|
||||
|
@ -25,6 +25,9 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
|
||||
@ -715,7 +718,7 @@ class ContextInitializer {
|
||||
}
|
||||
private:
|
||||
v8::HandleScope scope_;
|
||||
v8::Handle<v8::Context> env_;
|
||||
v8::Local<v8::Context> env_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -25,6 +25,8 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include "src/assembler.h"
|
||||
#include "test/cctest/cctest.h"
|
||||
|
@ -25,6 +25,9 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include "test/cctest/cctest.h"
|
||||
|
||||
#include "src/property-details.h"
|
||||
|
@ -4,6 +4,9 @@
|
||||
//
|
||||
// Tests the sampling API in include/v8.h
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "include/v8.h"
|
||||
@ -94,14 +97,13 @@ class SamplingTestHelper {
|
||||
DCHECK(!instance_);
|
||||
instance_ = this;
|
||||
v8::HandleScope scope(isolate_);
|
||||
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_);
|
||||
global->Set(v8::String::NewFromUtf8(isolate_, "CollectSample"),
|
||||
v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_);
|
||||
global->Set(v8_str("CollectSample"),
|
||||
v8::FunctionTemplate::New(isolate_, CollectSample));
|
||||
LocalContext env(isolate_, NULL, global);
|
||||
isolate_->SetJitCodeEventHandler(v8::kJitCodeEventDefault,
|
||||
JitCodeEventHandler);
|
||||
v8::Script::Compile(
|
||||
v8::String::NewFromUtf8(isolate_, test_function.c_str()))->Run();
|
||||
CompileRun(v8_str(test_function.c_str()));
|
||||
}
|
||||
|
||||
~SamplingTestHelper() {
|
||||
|
@ -25,6 +25,9 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
@ -244,9 +247,11 @@ UNINITIALIZED_DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) {
|
||||
env->Enter();
|
||||
|
||||
const char* c_source = "\"1234\".length";
|
||||
v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, c_source);
|
||||
v8::Local<v8::Script> script = v8::Script::Compile(source);
|
||||
CHECK_EQ(4, script->Run()->Int32Value());
|
||||
v8::Local<v8::Script> script = v8_compile(c_source);
|
||||
v8::Maybe<int32_t> result = script->Run(isolate->GetCurrentContext())
|
||||
.ToLocalChecked()
|
||||
->Int32Value(isolate->GetCurrentContext());
|
||||
CHECK_EQ(4, result.FromJust());
|
||||
}
|
||||
isolate->Dispose();
|
||||
}
|
||||
@ -265,9 +270,11 @@ UNINITIALIZED_DEPENDENT_TEST(DeserializeFromSecondSerializationAndRunScript2,
|
||||
env->Enter();
|
||||
|
||||
const char* c_source = "\"1234\".length";
|
||||
v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, c_source);
|
||||
v8::Local<v8::Script> script = v8::Script::Compile(source);
|
||||
CHECK_EQ(4, script->Run()->Int32Value());
|
||||
v8::Local<v8::Script> script = v8_compile(c_source);
|
||||
v8::Maybe<int32_t> result = script->Run(isolate->GetCurrentContext())
|
||||
.ToLocalChecked()
|
||||
->Int32Value(isolate->GetCurrentContext());
|
||||
CHECK_EQ(4, result.FromJust());
|
||||
}
|
||||
isolate->Dispose();
|
||||
}
|
||||
@ -305,7 +312,7 @@ UNINITIALIZED_TEST(PartialSerialization) {
|
||||
Object* raw_foo;
|
||||
{
|
||||
v8::HandleScope handle_scope(v8_isolate);
|
||||
v8::Local<v8::String> foo = v8::String::NewFromUtf8(v8_isolate, "foo");
|
||||
v8::Local<v8::String> foo = v8_str("foo");
|
||||
DCHECK(!foo.IsEmpty());
|
||||
raw_foo = *(v8::Utils::OpenHandle(*foo));
|
||||
}
|
||||
@ -544,10 +551,10 @@ UNINITIALIZED_TEST(CustomContextSerialization) {
|
||||
STATIC_CHAR_VECTOR("function g() { return [,"),
|
||||
STATIC_CHAR_VECTOR("1,"),
|
||||
STATIC_CHAR_VECTOR("];} a = g(); b = g(); b.push(1);"), 100000);
|
||||
v8::Handle<v8::String> source_str = v8::String::NewFromOneByte(
|
||||
v8_isolate, source.start(), v8::String::kNormalString,
|
||||
v8::MaybeLocal<v8::String> source_str = v8::String::NewFromOneByte(
|
||||
v8_isolate, source.start(), v8::NewStringType::kNormal,
|
||||
source.length());
|
||||
CompileRun(source_str);
|
||||
CompileRun(source_str.ToLocalChecked());
|
||||
source.Dispose();
|
||||
}
|
||||
// Make sure all builtin scripts are cached.
|
||||
@ -641,19 +648,41 @@ UNINITIALIZED_DEPENDENT_TEST(CustomContextDeserialization,
|
||||
Handle<Object> property = JSReceiver::GetDataProperty(global_object, o);
|
||||
CHECK(property.is_identical_to(global_proxy));
|
||||
|
||||
v8::Handle<v8::Context> v8_context = v8::Utils::ToLocal(context);
|
||||
v8::Local<v8::Context> v8_context = v8::Utils::ToLocal(context);
|
||||
v8::Context::Scope context_scope(v8_context);
|
||||
double r = CompileRun("r")->ToNumber(v8_isolate)->Value();
|
||||
double r = CompileRun("r")
|
||||
->ToNumber(v8_isolate->GetCurrentContext())
|
||||
.ToLocalChecked()
|
||||
->Value();
|
||||
CHECK(r >= 1 && r <= 2);
|
||||
int f = CompileRun("f()")->ToNumber(v8_isolate)->Int32Value();
|
||||
int f = CompileRun("f()")
|
||||
->ToNumber(v8_isolate->GetCurrentContext())
|
||||
.ToLocalChecked()
|
||||
->Int32Value(v8_isolate->GetCurrentContext())
|
||||
.FromJust();
|
||||
CHECK_EQ(5, f);
|
||||
f = CompileRun("e('f()')")->ToNumber(v8_isolate)->Int32Value();
|
||||
f = CompileRun("e('f()')")
|
||||
->ToNumber(v8_isolate->GetCurrentContext())
|
||||
.ToLocalChecked()
|
||||
->Int32Value(v8_isolate->GetCurrentContext())
|
||||
.FromJust();
|
||||
CHECK_EQ(5, f);
|
||||
v8::Handle<v8::String> s = CompileRun("s")->ToString(v8_isolate);
|
||||
CHECK(s->Equals(v8_str("12345")));
|
||||
int a = CompileRun("a.length")->ToNumber(v8_isolate)->Int32Value();
|
||||
v8::Local<v8::String> s = CompileRun("s")
|
||||
->ToString(v8_isolate->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
CHECK(s->Equals(v8_isolate->GetCurrentContext(), v8_str("12345"))
|
||||
.FromJust());
|
||||
int a = CompileRun("a.length")
|
||||
->ToNumber(v8_isolate->GetCurrentContext())
|
||||
.ToLocalChecked()
|
||||
->Int32Value(v8_isolate->GetCurrentContext())
|
||||
.FromJust();
|
||||
CHECK_EQ(100001, a);
|
||||
int b = CompileRun("b.length")->ToNumber(v8_isolate)->Int32Value();
|
||||
int b = CompileRun("b.length")
|
||||
->ToNumber(v8_isolate->GetCurrentContext())
|
||||
.ToLocalChecked()
|
||||
->Int32Value(v8_isolate->GetCurrentContext())
|
||||
.FromJust();
|
||||
CHECK_EQ(100002, b);
|
||||
}
|
||||
DeleteArray(snapshot);
|
||||
@ -684,7 +713,9 @@ TEST(PerIsolateSnapshotBlobs) {
|
||||
v8::Local<v8::Context> context = v8::Context::New(isolate1);
|
||||
delete[] data1.data; // We can dispose of the snapshot blob now.
|
||||
v8::Context::Scope c_scope(context);
|
||||
CHECK_EQ(42, CompileRun("f()")->ToInt32(isolate1)->Int32Value());
|
||||
v8::Maybe<int32_t> result =
|
||||
CompileRun("f()")->Int32Value(isolate1->GetCurrentContext());
|
||||
CHECK_EQ(42, result.FromJust());
|
||||
CHECK(CompileRun("this.g")->IsUndefined());
|
||||
}
|
||||
isolate1->Dispose();
|
||||
@ -699,8 +730,11 @@ TEST(PerIsolateSnapshotBlobs) {
|
||||
v8::Local<v8::Context> context = v8::Context::New(isolate2);
|
||||
delete[] data2.data; // We can dispose of the snapshot blob now.
|
||||
v8::Context::Scope c_scope(context);
|
||||
CHECK_EQ(86, CompileRun("f()")->ToInt32(isolate2)->Int32Value());
|
||||
CHECK_EQ(43, CompileRun("g()")->ToInt32(isolate2)->Int32Value());
|
||||
v8::Maybe<int32_t> result =
|
||||
CompileRun("f()")->Int32Value(isolate2->GetCurrentContext());
|
||||
CHECK_EQ(86, result.FromJust());
|
||||
result = CompileRun("g()")->Int32Value(isolate2->GetCurrentContext());
|
||||
CHECK_EQ(43, result.FromJust());
|
||||
}
|
||||
isolate2->Dispose();
|
||||
}
|
||||
@ -751,7 +785,9 @@ TEST(PerIsolateSnapshotBlobsOutdatedContextWithOverflow) {
|
||||
delete[] data.data; // We can dispose of the snapshot blob now.
|
||||
v8::Context::Scope c_scope(context);
|
||||
v8::Local<v8::Value> result = CompileRun(source2);
|
||||
CHECK(v8_str("42")->Equals(result));
|
||||
v8::Maybe<bool> compare = v8_str("42")->Equals(
|
||||
v8::Isolate::GetCurrent()->GetCurrentContext(), result);
|
||||
CHECK(compare.FromJust());
|
||||
}
|
||||
isolate->Dispose();
|
||||
}
|
||||
@ -768,7 +804,9 @@ TEST(PerIsolateSnapshotBlobsWithLocker) {
|
||||
v8::HandleScope h_scope(isolate0);
|
||||
v8::Local<v8::Context> context = v8::Context::New(isolate0);
|
||||
v8::Context::Scope c_scope(context);
|
||||
CHECK_EQ(1, CompileRun("Math.cos(0)")->ToInt32(isolate0)->Int32Value());
|
||||
v8::Maybe<int32_t> result =
|
||||
CompileRun("Math.cos(0)")->Int32Value(isolate0->GetCurrentContext());
|
||||
CHECK_EQ(1, result.FromJust());
|
||||
}
|
||||
isolate0->Dispose();
|
||||
|
||||
@ -787,7 +825,8 @@ TEST(PerIsolateSnapshotBlobsWithLocker) {
|
||||
v8::Local<v8::Context> context = v8::Context::New(isolate1);
|
||||
delete[] data1.data; // We can dispose of the snapshot blob now.
|
||||
v8::Context::Scope c_scope(context);
|
||||
CHECK_EQ(42, CompileRun("f()")->ToInt32(isolate1)->Int32Value());
|
||||
v8::Maybe<int32_t> result = CompileRun("f()")->Int32Value(context);
|
||||
CHECK_EQ(42, result.FromJust());
|
||||
}
|
||||
isolate1->Dispose();
|
||||
}
|
||||
@ -825,7 +864,9 @@ TEST(SnapshotBlobsStackOverflow) {
|
||||
" a = a[1];"
|
||||
"}"
|
||||
"sum";
|
||||
CHECK_EQ(9999 * 5000, CompileRun(test)->ToInt32(isolate)->Int32Value());
|
||||
v8::Maybe<int32_t> result =
|
||||
CompileRun(test)->Int32Value(isolate->GetCurrentContext());
|
||||
CHECK_EQ(9999 * 5000, result.FromJust());
|
||||
}
|
||||
isolate->Dispose();
|
||||
}
|
||||
@ -1170,18 +1211,27 @@ TEST(SerializeToplevelThreeBigStrings) {
|
||||
|
||||
USE(Execution::Call(isolate, copy_fun, global, 0, NULL));
|
||||
|
||||
CHECK_EQ(600000 + 700000, CompileRun("(a + b).length")->Int32Value());
|
||||
CHECK_EQ(500000 + 600000, CompileRun("(b + c).length")->Int32Value());
|
||||
v8::Maybe<int32_t> result =
|
||||
CompileRun("(a + b).length")
|
||||
->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext());
|
||||
CHECK_EQ(600000 + 700000, result.FromJust());
|
||||
result = CompileRun("(b + c).length")
|
||||
->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext());
|
||||
CHECK_EQ(500000 + 600000, result.FromJust());
|
||||
Heap* heap = isolate->heap();
|
||||
CHECK(heap->InSpace(
|
||||
*v8::Utils::OpenHandle(*CompileRun("a")->ToString(CcTest::isolate())),
|
||||
OLD_SPACE));
|
||||
CHECK(heap->InSpace(
|
||||
*v8::Utils::OpenHandle(*CompileRun("b")->ToString(CcTest::isolate())),
|
||||
OLD_SPACE));
|
||||
CHECK(heap->InSpace(
|
||||
*v8::Utils::OpenHandle(*CompileRun("c")->ToString(CcTest::isolate())),
|
||||
OLD_SPACE));
|
||||
v8::Local<v8::String> result_str =
|
||||
CompileRun("a")
|
||||
->ToString(CcTest::isolate()->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), OLD_SPACE));
|
||||
result_str = CompileRun("b")
|
||||
->ToString(CcTest::isolate()->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), OLD_SPACE));
|
||||
result_str = CompileRun("c")
|
||||
->ToString(CcTest::isolate()->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), OLD_SPACE));
|
||||
|
||||
delete cache;
|
||||
source_a.Dispose();
|
||||
@ -1416,8 +1466,10 @@ v8::ScriptCompiler::CachedData* ProduceCache(const char* source) {
|
||||
v8::Local<v8::String> source_str = v8_str(source);
|
||||
v8::ScriptOrigin origin(v8_str("test"));
|
||||
v8::ScriptCompiler::Source source(source_str, origin);
|
||||
v8::Local<v8::UnboundScript> script = v8::ScriptCompiler::CompileUnbound(
|
||||
isolate1, &source, v8::ScriptCompiler::kProduceCodeCache);
|
||||
v8::Local<v8::UnboundScript> script =
|
||||
v8::ScriptCompiler::CompileUnboundScript(
|
||||
isolate1, &source, v8::ScriptCompiler::kProduceCodeCache)
|
||||
.ToLocalChecked();
|
||||
const v8::ScriptCompiler::CachedData* data = source.GetCachedData();
|
||||
CHECK(data);
|
||||
// Persist cached data.
|
||||
@ -1426,8 +1478,13 @@ v8::ScriptCompiler::CachedData* ProduceCache(const char* source) {
|
||||
cache = new v8::ScriptCompiler::CachedData(
|
||||
buffer, data->length, v8::ScriptCompiler::CachedData::BufferOwned);
|
||||
|
||||
v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
|
||||
CHECK(result->ToString(isolate1)->Equals(v8_str("abcdef")));
|
||||
v8::Local<v8::Value> result = script->BindToCurrentContext()
|
||||
->Run(isolate1->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
v8::Local<v8::String> result_string =
|
||||
result->ToString(isolate1->GetCurrentContext()).ToLocalChecked();
|
||||
CHECK(result_string->Equals(isolate1->GetCurrentContext(), v8_str("abcdef"))
|
||||
.FromJust());
|
||||
}
|
||||
isolate1->Dispose();
|
||||
return cache;
|
||||
@ -1458,12 +1515,18 @@ TEST(SerializeToplevelIsolates) {
|
||||
v8::Local<v8::UnboundScript> script;
|
||||
{
|
||||
DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2));
|
||||
script = v8::ScriptCompiler::CompileUnbound(
|
||||
isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache);
|
||||
script = v8::ScriptCompiler::CompileUnboundScript(
|
||||
isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache)
|
||||
.ToLocalChecked();
|
||||
}
|
||||
CHECK(!cache->rejected);
|
||||
v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
|
||||
CHECK(result->ToString(isolate2)->Equals(v8_str("abcdef")));
|
||||
v8::Local<v8::Value> result = script->BindToCurrentContext()
|
||||
->Run(isolate2->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
CHECK(result->ToString(isolate2->GetCurrentContext())
|
||||
.ToLocalChecked()
|
||||
->Equals(isolate2->GetCurrentContext(), v8_str("abcdef"))
|
||||
.FromJust());
|
||||
}
|
||||
DCHECK(toplevel_test_code_event_found);
|
||||
isolate2->Dispose();
|
||||
@ -1491,8 +1554,9 @@ TEST(SerializeToplevelFlagChange) {
|
||||
v8::Local<v8::String> source_str = v8_str(source);
|
||||
v8::ScriptOrigin origin(v8_str("test"));
|
||||
v8::ScriptCompiler::Source source(source_str, origin, cache);
|
||||
v8::ScriptCompiler::CompileUnbound(isolate2, &source,
|
||||
v8::ScriptCompiler::kConsumeCodeCache);
|
||||
v8::ScriptCompiler::CompileUnboundScript(
|
||||
isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache)
|
||||
.ToLocalChecked();
|
||||
CHECK(cache->rejected);
|
||||
}
|
||||
isolate2->Dispose();
|
||||
@ -1520,8 +1584,9 @@ TEST(SerializeToplevelBitFlip) {
|
||||
v8::Local<v8::String> source_str = v8_str(source);
|
||||
v8::ScriptOrigin origin(v8_str("test"));
|
||||
v8::ScriptCompiler::Source source(source_str, origin, cache);
|
||||
v8::ScriptCompiler::CompileUnbound(isolate2, &source,
|
||||
v8::ScriptCompiler::kConsumeCodeCache);
|
||||
v8::ScriptCompiler::CompileUnboundScript(
|
||||
isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache)
|
||||
.ToLocalChecked();
|
||||
CHECK(cache->rejected);
|
||||
}
|
||||
isolate2->Dispose();
|
||||
@ -1552,8 +1617,10 @@ TEST(SerializeWithHarmonyScoping) {
|
||||
v8::Local<v8::String> source_str = v8_str(source3);
|
||||
v8::ScriptOrigin origin(v8_str("test"));
|
||||
v8::ScriptCompiler::Source source(source_str, origin);
|
||||
v8::Local<v8::UnboundScript> script = v8::ScriptCompiler::CompileUnbound(
|
||||
isolate1, &source, v8::ScriptCompiler::kProduceCodeCache);
|
||||
v8::Local<v8::UnboundScript> script =
|
||||
v8::ScriptCompiler::CompileUnboundScript(
|
||||
isolate1, &source, v8::ScriptCompiler::kProduceCodeCache)
|
||||
.ToLocalChecked();
|
||||
const v8::ScriptCompiler::CachedData* data = source.GetCachedData();
|
||||
CHECK(data);
|
||||
// Persist cached data.
|
||||
@ -1562,8 +1629,13 @@ TEST(SerializeWithHarmonyScoping) {
|
||||
cache = new v8::ScriptCompiler::CachedData(
|
||||
buffer, data->length, v8::ScriptCompiler::CachedData::BufferOwned);
|
||||
|
||||
v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
|
||||
CHECK(result->ToString(isolate1)->Equals(v8_str("XY")));
|
||||
v8::Local<v8::Value> result = script->BindToCurrentContext()
|
||||
->Run(isolate1->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
v8::Local<v8::String> result_str =
|
||||
result->ToString(isolate1->GetCurrentContext()).ToLocalChecked();
|
||||
CHECK(result_str->Equals(isolate1->GetCurrentContext(), v8_str("XY"))
|
||||
.FromJust());
|
||||
}
|
||||
isolate1->Dispose();
|
||||
|
||||
@ -1584,11 +1656,17 @@ TEST(SerializeWithHarmonyScoping) {
|
||||
v8::Local<v8::UnboundScript> script;
|
||||
{
|
||||
DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2));
|
||||
script = v8::ScriptCompiler::CompileUnbound(
|
||||
isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache);
|
||||
script = v8::ScriptCompiler::CompileUnboundScript(
|
||||
isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache)
|
||||
.ToLocalChecked();
|
||||
}
|
||||
v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
|
||||
CHECK(result->ToString(isolate2)->Equals(v8_str("XY")));
|
||||
v8::Local<v8::Value> result = script->BindToCurrentContext()
|
||||
->Run(isolate2->GetCurrentContext())
|
||||
.ToLocalChecked();
|
||||
v8::Local<v8::String> result_str =
|
||||
result->ToString(isolate2->GetCurrentContext()).ToLocalChecked();
|
||||
CHECK(result_str->Equals(isolate2->GetCurrentContext(), v8_str("XY"))
|
||||
.FromJust());
|
||||
}
|
||||
isolate2->Dispose();
|
||||
}
|
||||
@ -1637,8 +1715,8 @@ TEST(SerializeInternalReference) {
|
||||
v8::Local<v8::Context> context = v8::Context::New(isolate);
|
||||
delete[] data.data; // We can dispose of the snapshot blob now.
|
||||
v8::Context::Scope c_scope(context);
|
||||
v8::Handle<v8::Function> foo =
|
||||
v8::Handle<v8::Function>::Cast(CompileRun("foo"));
|
||||
v8::Local<v8::Function> foo =
|
||||
v8::Local<v8::Function>::Cast(CompileRun("foo"));
|
||||
|
||||
// There are at least 6 internal references.
|
||||
int mask = RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) |
|
||||
@ -1650,13 +1728,27 @@ TEST(SerializeInternalReference) {
|
||||
}
|
||||
|
||||
CHECK(v8::Utils::OpenHandle(*foo)->code()->is_turbofanned());
|
||||
CHECK_EQ(11, CompileRun("foo(0)")->ToInt32(isolate)->Int32Value());
|
||||
CHECK_EQ(11, CompileRun("foo(1)")->ToInt32(isolate)->Int32Value());
|
||||
CHECK_EQ(12, CompileRun("foo(2)")->ToInt32(isolate)->Int32Value());
|
||||
CHECK_EQ(12, CompileRun("foo(3)")->ToInt32(isolate)->Int32Value());
|
||||
CHECK_EQ(23, CompileRun("foo(4)")->ToInt32(isolate)->Int32Value());
|
||||
CHECK_EQ(23, CompileRun("foo(5)")->ToInt32(isolate)->Int32Value());
|
||||
CHECK_EQ(10, CompileRun("foo(6)")->ToInt32(isolate)->Int32Value());
|
||||
CHECK_EQ(11, CompileRun("foo(0)")
|
||||
->Int32Value(isolate->GetCurrentContext())
|
||||
.FromJust());
|
||||
CHECK_EQ(11, CompileRun("foo(1)")
|
||||
->Int32Value(isolate->GetCurrentContext())
|
||||
.FromJust());
|
||||
CHECK_EQ(12, CompileRun("foo(2)")
|
||||
->Int32Value(isolate->GetCurrentContext())
|
||||
.FromJust());
|
||||
CHECK_EQ(12, CompileRun("foo(3)")
|
||||
->Int32Value(isolate->GetCurrentContext())
|
||||
.FromJust());
|
||||
CHECK_EQ(23, CompileRun("foo(4)")
|
||||
->Int32Value(isolate->GetCurrentContext())
|
||||
.FromJust());
|
||||
CHECK_EQ(23, CompileRun("foo(5)")
|
||||
->Int32Value(isolate->GetCurrentContext())
|
||||
.FromJust());
|
||||
CHECK_EQ(10, CompileRun("foo(6)")
|
||||
->Int32Value(isolate->GetCurrentContext())
|
||||
.FromJust());
|
||||
}
|
||||
isolate->Dispose();
|
||||
}
|
||||
|
@ -2,6 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include "src/v8.h"
|
||||
|
||||
#include "src/objects.h"
|
||||
|
@ -2,6 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include "src/heap/slots-buffer.h"
|
||||
#include "test/cctest/cctest.h"
|
||||
|
||||
|
@ -25,6 +25,9 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "src/base/platform/platform.h"
|
||||
|
@ -25,6 +25,9 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "src/v8.h"
|
||||
|
@ -30,6 +30,9 @@
|
||||
// of ConsStrings. These operations may not be very fast, but they
|
||||
// should be possible without getting errors due to too deep recursion.
|
||||
|
||||
// TODO(mythria): Remove this define after this flag is turned on globally
|
||||
#define V8_IMMINENT_DEPRECATION_WARNINGS
|
||||
|
||||
#include "src/v8.h"
|
||||
|
||||
#include "src/objects.h"
|
||||
|
Loading…
Reference in New Issue
Block a user