Remove deprecated functions the smaller half of the remaing tests

BUG=4134
R=epertoso@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/1449393002

Cr-Commit-Position: refs/heads/master@{#32035}
This commit is contained in:
jochen 2015-11-17 04:42:14 -08:00 committed by Commit bot
parent 08eda0d7b0
commit 91769a6a96
14 changed files with 382 additions and 303 deletions

View File

@ -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(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include "include/v8.h"
#include "test/cctest/cctest.h"

View File

@ -25,14 +25,16 @@
// (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(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include "test/cctest/print-extension.h"
namespace v8 {
namespace internal {
v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate,
v8::Handle<v8::String> str) {
v8::Local<v8::FunctionTemplate> PrintExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Local<v8::String> str) {
return v8::FunctionTemplate::New(isolate, PrintExtension::Print);
}

View File

@ -36,9 +36,8 @@ namespace internal {
class PrintExtension : public v8::Extension {
public:
PrintExtension() : v8::Extension("v8/print", "native function print();") { }
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 Print(const v8::FunctionCallbackInfo<v8::Value>& args);
};

View File

@ -27,6 +27,9 @@
//
// Tests of profiles generator and utilities.
// TODO(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include "src/base/logging.h"
#include "test/cctest/profiler-extension.h"
@ -39,17 +42,25 @@ const char* ProfilerExtension::kSource =
"native function startProfiling();"
"native function stopProfiling();";
v8::Handle<v8::FunctionTemplate> ProfilerExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Handle<v8::String> name) {
if (name->Equals(v8::String::NewFromUtf8(isolate, "startProfiling"))) {
v8::Local<v8::FunctionTemplate> ProfilerExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Local<v8::String> name) {
v8::Local<v8::Context> context = isolate->GetCurrentContext();
if (name->Equals(context, v8::String::NewFromUtf8(isolate, "startProfiling",
v8::NewStringType::kNormal)
.ToLocalChecked())
.FromJust()) {
return v8::FunctionTemplate::New(isolate,
ProfilerExtension::StartProfiling);
} else if (name->Equals(v8::String::NewFromUtf8(isolate, "stopProfiling"))) {
} else if (name->Equals(context,
v8::String::NewFromUtf8(isolate, "stopProfiling",
v8::NewStringType::kNormal)
.ToLocalChecked())
.FromJust()) {
return v8::FunctionTemplate::New(isolate,
ProfilerExtension::StopProfiling);
} else {
CHECK(false);
return v8::Handle<v8::FunctionTemplate>();
return v8::Local<v8::FunctionTemplate>();
}
}

View File

@ -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(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include <stdlib.h>
#include "src/v8.h"

View File

@ -26,6 +26,9 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// TODO(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include "src/v8.h"
#include "src/api.h"
@ -49,7 +52,7 @@ using ::v8::internal::String;
using ::v8::internal::Vector;
static void CheckFunctionName(v8::Handle<v8::Script> script,
static void CheckFunctionName(v8::Local<v8::Script> script,
const char* func_pos_src,
const char* ref_inferred_name) {
Isolate* isolate = CcTest::i_isolate();
@ -93,8 +96,12 @@ static void CheckFunctionName(v8::Handle<v8::Script> script,
}
static v8::Handle<v8::Script> Compile(v8::Isolate* isolate, const char* src) {
return v8::Script::Compile(v8::String::NewFromUtf8(isolate, src));
static v8::Local<v8::Script> Compile(v8::Isolate* isolate, const char* src) {
return v8::Script::Compile(
isolate->GetCurrentContext(),
v8::String::NewFromUtf8(isolate, src, v8::NewStringType::kNormal)
.ToLocalChecked())
.ToLocalChecked();
}
@ -102,10 +109,9 @@ TEST(GlobalProperty) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"fun1 = function() { return 1; }\n"
"fun2 = function() { return 2; }\n");
v8::Local<v8::Script> script = Compile(CcTest::isolate(),
"fun1 = function() { return 1; }\n"
"fun2 = function() { return 2; }\n");
CheckFunctionName(script, "return 1", "fun1");
CheckFunctionName(script, "return 2", "fun2");
}
@ -115,10 +121,10 @@ TEST(GlobalVar) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"var fun1 = function() { return 1; }\n"
"var fun2 = function() { return 2; }\n");
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"var fun1 = function() { return 1; }\n"
"var fun2 = function() { return 2; }\n");
CheckFunctionName(script, "return 1", "fun1");
CheckFunctionName(script, "return 2", "fun2");
}
@ -128,12 +134,12 @@ TEST(LocalVar) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"function outer() {\n"
" var fun1 = function() { return 1; }\n"
" var fun2 = function() { return 2; }\n"
"}");
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"function outer() {\n"
" var fun1 = function() { return 1; }\n"
" var fun2 = function() { return 2; }\n"
"}");
CheckFunctionName(script, "return 1", "fun1");
CheckFunctionName(script, "return 2", "fun2");
}
@ -143,12 +149,12 @@ TEST(InConstructor) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"function MyClass() {\n"
" this.method1 = function() { return 1; }\n"
" this.method2 = function() { return 2; }\n"
"}");
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"function MyClass() {\n"
" this.method1 = function() { return 1; }\n"
" this.method2 = function() { return 2; }\n"
"}");
CheckFunctionName(script, "return 1", "MyClass.method1");
CheckFunctionName(script, "return 2", "MyClass.method2");
}
@ -158,14 +164,14 @@ TEST(Factory) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"function createMyObj() {\n"
" var obj = {};\n"
" obj.method1 = function() { return 1; }\n"
" obj.method2 = function() { return 2; }\n"
" return obj;\n"
"}");
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"function createMyObj() {\n"
" var obj = {};\n"
" obj.method1 = function() { return 1; }\n"
" obj.method2 = function() { return 2; }\n"
" return obj;\n"
"}");
CheckFunctionName(script, "return 1", "obj.method1");
CheckFunctionName(script, "return 2", "obj.method2");
}
@ -175,14 +181,14 @@ TEST(Static) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"function MyClass() {}\n"
"MyClass.static1 = function() { return 1; }\n"
"MyClass.static2 = function() { return 2; }\n"
"MyClass.MyInnerClass = {}\n"
"MyClass.MyInnerClass.static3 = function() { return 3; }\n"
"MyClass.MyInnerClass.static4 = function() { return 4; }");
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"function MyClass() {}\n"
"MyClass.static1 = function() { return 1; }\n"
"MyClass.static2 = function() { return 2; }\n"
"MyClass.MyInnerClass = {}\n"
"MyClass.MyInnerClass.static3 = function() { return 3; }\n"
"MyClass.MyInnerClass.static4 = function() { return 4; }");
CheckFunctionName(script, "return 1", "MyClass.static1");
CheckFunctionName(script, "return 2", "MyClass.static2");
CheckFunctionName(script, "return 3", "MyClass.MyInnerClass.static3");
@ -194,7 +200,7 @@ TEST(Prototype) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
v8::Local<v8::Script> script = Compile(
CcTest::isolate(),
"function MyClass() {}\n"
"MyClass.prototype.method1 = function() { return 1; }\n"
@ -213,12 +219,12 @@ TEST(ObjectLiteral) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"function MyClass() {}\n"
"MyClass.prototype = {\n"
" method1: function() { return 1; },\n"
" method2: function() { return 2; } }");
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"function MyClass() {}\n"
"MyClass.prototype = {\n"
" method1: function() { return 1; },\n"
" method2: function() { return 2; } }");
CheckFunctionName(script, "return 1", "MyClass.method1");
CheckFunctionName(script, "return 2", "MyClass.method2");
}
@ -228,16 +234,16 @@ TEST(UpperCaseClass) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(CcTest::isolate(),
"'use strict';\n"
"class MyClass {\n"
" constructor() {\n"
" this.value = 1;\n"
" }\n"
" method() {\n"
" this.value = 2;\n"
" }\n"
"}");
v8::Local<v8::Script> script = Compile(CcTest::isolate(),
"'use strict';\n"
"class MyClass {\n"
" constructor() {\n"
" this.value = 1;\n"
" }\n"
" method() {\n"
" this.value = 2;\n"
" }\n"
"}");
CheckFunctionName(script, "this.value = 1", "MyClass");
CheckFunctionName(script, "this.value = 2", "MyClass.method");
}
@ -247,16 +253,16 @@ TEST(LowerCaseClass) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(CcTest::isolate(),
"'use strict';\n"
"class myclass {\n"
" constructor() {\n"
" this.value = 1;\n"
" }\n"
" method() {\n"
" this.value = 2;\n"
" }\n"
"}");
v8::Local<v8::Script> script = Compile(CcTest::isolate(),
"'use strict';\n"
"class myclass {\n"
" constructor() {\n"
" this.value = 1;\n"
" }\n"
" method() {\n"
" this.value = 2;\n"
" }\n"
"}");
CheckFunctionName(script, "this.value = 1", "myclass");
CheckFunctionName(script, "this.value = 2", "myclass.method");
}
@ -266,7 +272,7 @@ TEST(AsParameter) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
v8::Local<v8::Script> script = Compile(
CcTest::isolate(),
"function f1(a) { return a(); }\n"
"function f2(a, b) { return a() + b(); }\n"
@ -283,11 +289,10 @@ TEST(MultipleFuncsConditional) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"fun1 = 0 ?\n"
" function() { return 1; } :\n"
" function() { return 2; }");
v8::Local<v8::Script> script = Compile(CcTest::isolate(),
"fun1 = 0 ?\n"
" function() { return 1; } :\n"
" function() { return 2; }");
CheckFunctionName(script, "return 1", "fun1");
CheckFunctionName(script, "return 2", "fun1");
}
@ -297,12 +302,12 @@ TEST(MultipleFuncsInLiteral) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"function MyClass() {}\n"
"MyClass.prototype = {\n"
" method1: 0 ? function() { return 1; } :\n"
" function() { return 2; } }");
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"function MyClass() {}\n"
"MyClass.prototype = {\n"
" method1: 0 ? function() { return 1; } :\n"
" function() { return 2; } }");
CheckFunctionName(script, "return 1", "MyClass.method1");
CheckFunctionName(script, "return 2", "MyClass.method1");
}
@ -312,18 +317,17 @@ TEST(AnonymousInAnonymousClosure1) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"(function() {\n"
" (function() {\n"
" var a = 1;\n"
" return;\n"
" })();\n"
" var b = function() {\n"
" var c = 1;\n"
" return;\n"
" };\n"
"})();");
v8::Local<v8::Script> script = Compile(CcTest::isolate(),
"(function() {\n"
" (function() {\n"
" var a = 1;\n"
" return;\n"
" })();\n"
" var b = function() {\n"
" var c = 1;\n"
" return;\n"
" };\n"
"})();");
CheckFunctionName(script, "return", "");
}
@ -332,15 +336,14 @@ TEST(AnonymousInAnonymousClosure2) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"(function() {\n"
" (function() {\n"
" var a = 1;\n"
" return;\n"
" })();\n"
" var c = 1;\n"
"})();");
v8::Local<v8::Script> script = Compile(CcTest::isolate(),
"(function() {\n"
" (function() {\n"
" var a = 1;\n"
" return;\n"
" })();\n"
" var c = 1;\n"
"})();");
CheckFunctionName(script, "return", "");
}
@ -349,15 +352,14 @@ TEST(NamedInAnonymousClosure) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"var foo = function() {\n"
" (function named() {\n"
" var a = 1;\n"
" })();\n"
" var c = 1;\n"
" return;\n"
"};");
v8::Local<v8::Script> script = Compile(CcTest::isolate(),
"var foo = function() {\n"
" (function named() {\n"
" var a = 1;\n"
" })();\n"
" var c = 1;\n"
" return;\n"
"};");
CheckFunctionName(script, "return", "foo");
}
@ -367,12 +369,12 @@ TEST(Issue380) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"function a() {\n"
"var result = function(p,a,c,k,e,d)"
"{return p}(\"if blah blah\",62,1976,\'a|b\'.split(\'|\'),0,{})\n"
"}");
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"function a() {\n"
"var result = function(p,a,c,k,e,d)"
"{return p}(\"if blah blah\",62,1976,\'a|b\'.split(\'|\'),0,{})\n"
"}");
CheckFunctionName(script, "return p", "");
}
@ -381,12 +383,12 @@ TEST(MultipleAssignments) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"var fun1 = fun2 = function () { return 1; }\n"
"var bar1 = bar2 = bar3 = function () { return 2; }\n"
"foo1 = foo2 = function () { return 3; }\n"
"baz1 = baz2 = baz3 = function () { return 4; }");
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"var fun1 = fun2 = function () { return 1; }\n"
"var bar1 = bar2 = bar3 = function () { return 2; }\n"
"foo1 = foo2 = function () { return 3; }\n"
"baz1 = baz2 = baz3 = function () { return 4; }");
CheckFunctionName(script, "return 1", "fun2");
CheckFunctionName(script, "return 2", "bar3");
CheckFunctionName(script, "return 3", "foo2");
@ -398,7 +400,7 @@ TEST(AsConstructorParameter) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
v8::Local<v8::Script> script = Compile(
CcTest::isolate(),
"function Foo() {}\n"
"var foo = new Foo(function() { return 1; })\n"
@ -413,14 +415,14 @@ TEST(FactoryHashmap) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"function createMyObj() {\n"
" var obj = {};\n"
" obj[\"method1\"] = function() { return 1; }\n"
" obj[\"method2\"] = function() { return 2; }\n"
" return obj;\n"
"}");
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"function createMyObj() {\n"
" var obj = {};\n"
" obj[\"method1\"] = function() { return 1; }\n"
" obj[\"method2\"] = function() { return 2; }\n"
" return obj;\n"
"}");
CheckFunctionName(script, "return 1", "obj.method1");
CheckFunctionName(script, "return 2", "obj.method2");
}
@ -430,16 +432,16 @@ TEST(FactoryHashmapVariable) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"function createMyObj() {\n"
" var obj = {};\n"
" var methodName = \"method1\";\n"
" obj[methodName] = function() { return 1; }\n"
" methodName = \"method2\";\n"
" obj[methodName] = function() { return 2; }\n"
" return obj;\n"
"}");
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"function createMyObj() {\n"
" var obj = {};\n"
" var methodName = \"method1\";\n"
" obj[methodName] = function() { return 1; }\n"
" methodName = \"method2\";\n"
" obj[methodName] = function() { return 2; }\n"
" return obj;\n"
"}");
// Can't infer function names statically.
CheckFunctionName(script, "return 1", "obj.(anonymous function)");
CheckFunctionName(script, "return 2", "obj.(anonymous function)");
@ -450,7 +452,7 @@ TEST(FactoryHashmapConditional) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
v8::Local<v8::Script> script = Compile(
CcTest::isolate(),
"function createMyObj() {\n"
" var obj = {};\n"
@ -466,14 +468,13 @@ TEST(GlobalAssignmentAndCall) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"var Foo = function() {\n"
" return 1;\n"
"}();\n"
"var Baz = Bar = function() {\n"
" return 2;\n"
"}");
v8::Local<v8::Script> script = Compile(CcTest::isolate(),
"var Foo = function() {\n"
" return 1;\n"
"}();\n"
"var Baz = Bar = function() {\n"
" return 2;\n"
"}");
// The inferred name is empty, because this is an assignment of a result.
CheckFunctionName(script, "return 1", "");
// See MultipleAssignments test.
@ -485,17 +486,16 @@ TEST(AssignmentAndCall) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"(function Enclosing() {\n"
" var Foo;\n"
" Foo = function() {\n"
" return 1;\n"
" }();\n"
" var Baz = Bar = function() {\n"
" return 2;\n"
" }\n"
"})();");
v8::Local<v8::Script> script = Compile(CcTest::isolate(),
"(function Enclosing() {\n"
" var Foo;\n"
" Foo = function() {\n"
" return 1;\n"
" }();\n"
" var Baz = Bar = function() {\n"
" return 2;\n"
" }\n"
"})();");
// The inferred name is empty, because this is an assignment of a result.
CheckFunctionName(script, "return 1", "");
// See MultipleAssignments test.
@ -509,15 +509,15 @@ TEST(MethodAssignmentInAnonymousFunctionCall) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"(function () {\n"
" var EventSource = function () { };\n"
" EventSource.prototype.addListener = function () {\n"
" return 2012;\n"
" };\n"
" this.PublicEventSource = EventSource;\n"
"})();");
v8::Local<v8::Script> script =
Compile(CcTest::isolate(),
"(function () {\n"
" var EventSource = function () { };\n"
" EventSource.prototype.addListener = function () {\n"
" return 2012;\n"
" };\n"
" this.PublicEventSource = EventSource;\n"
"})();");
CheckFunctionName(script, "return 2012", "EventSource.addListener");
}
@ -526,20 +526,19 @@ TEST(ReturnAnonymousFunction) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
CcTest::isolate(),
"(function() {\n"
" function wrapCode() {\n"
" return function () {\n"
" return 2012;\n"
" };\n"
" };\n"
" var foo = 10;\n"
" function f() {\n"
" return wrapCode();\n"
" }\n"
" this.ref = f;\n"
"})()");
script->Run();
v8::Local<v8::Script> script = Compile(CcTest::isolate(),
"(function() {\n"
" function wrapCode() {\n"
" return function () {\n"
" return 2012;\n"
" };\n"
" };\n"
" var foo = 10;\n"
" function f() {\n"
" return wrapCode();\n"
" }\n"
" this.ref = f;\n"
"})()");
script->Run(CcTest::isolate()->GetCurrentContext()).ToLocalChecked();
CheckFunctionName(script, "return 2012", "");
}

View File

@ -22,6 +22,9 @@
// OR TORT (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(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include <stdlib.h>
#include "test/cctest/cctest.h"

View File

@ -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(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include "src/global-handles.h"
#include "test/cctest/cctest.h"
@ -337,7 +340,9 @@ TEST(EternalHandles) {
indices[i] = -1;
HandleScope scope(isolate);
v8::Local<v8::Object> object = v8::Object::New(v8_isolate);
object->Set(i, v8::Integer::New(v8_isolate, i));
object->Set(v8_isolate->GetCurrentContext(), i,
v8::Integer::New(v8_isolate, i))
.FromJust();
// Create with internal api
eternal_handles->Create(
isolate, *v8::Utils::OpenHandle(*object), &indices[i]);
@ -360,10 +365,12 @@ TEST(EternalHandles) {
// Test external api
local = eternals[i].Get(v8_isolate);
}
v8::Local<v8::Object> object = v8::Handle<v8::Object>::Cast(local);
v8::Local<v8::Value> value = object->Get(i);
v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(local);
v8::Local<v8::Value> value =
object->Get(v8_isolate->GetCurrentContext(), i).ToLocalChecked();
CHECK(value->IsInt32());
CHECK_EQ(i, value->Int32Value());
CHECK_EQ(i,
value->Int32Value(v8_isolate->GetCurrentContext()).FromJust());
}
}

View File

@ -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(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include "src/api.h"
#include "src/v8.h"
#include "test/cctest/cctest.h"
@ -42,12 +45,12 @@ TEST(StrictUndeclaredGlobalVariable) {
LocalContext context;
v8::TryCatch try_catch(CcTest::isolate());
v8::Local<v8::Script> script = v8_compile("\"use strict\"; x = 42;");
v8::Handle<v8::Object> proto = v8::Object::New(CcTest::isolate());
v8::Handle<v8::Object> global =
v8::Local<v8::Object> proto = v8::Object::New(CcTest::isolate());
v8::Local<v8::Object> global =
context->Global()->GetPrototype().As<v8::Object>();
proto->Set(var_name, v8_num(100));
global->SetPrototype(proto);
script->Run();
proto->Set(context.local(), var_name, v8_num(100)).FromJust();
global->SetPrototype(context.local(), proto).FromJust();
CHECK(script->Run(context.local()).IsEmpty());
CHECK(try_catch.HasCaught());
v8::String::Utf8Value exception(try_catch.Exception());
CHECK_EQ(0, strcmp("ReferenceError: x is not defined", *exception));
@ -59,7 +62,7 @@ TEST(KeysGlobalObject_Regress2764) {
v8::HandleScope scope(env1->GetIsolate());
// Create second environment.
v8::Handle<Context> env2 = Context::New(env1->GetIsolate());
v8::Local<Context> env2 = Context::New(env1->GetIsolate());
Local<Value> token = v8_str("foo");
@ -68,17 +71,25 @@ TEST(KeysGlobalObject_Regress2764) {
env2->SetSecurityToken(token);
// Create a reference to env2 global from env1 global.
env1->Global()->Set(v8_str("global2"), env2->Global());
env1->Global()
->Set(env1.local(), v8_str("global2"), env2->Global())
.FromJust();
// Set some global variables in global2
env2->Global()->Set(v8_str("a"), v8_str("a"));
env2->Global()->Set(v8_str("42"), v8_str("42"));
env2->Global()->Set(env2, v8_str("a"), v8_str("a")).FromJust();
env2->Global()->Set(env2, v8_str("42"), v8_str("42")).FromJust();
// List all entries from global2.
Local<Array> result;
result = Local<Array>::Cast(CompileRun("Object.keys(global2)"));
CHECK_EQ(2u, result->Length());
CHECK(v8_str("42")->Equals(result->Get(0)));
CHECK(v8_str("a")->Equals(result->Get(1)));
CHECK(
v8_str("42")
->Equals(env1.local(), result->Get(env1.local(), 0).ToLocalChecked())
.FromJust());
CHECK(
v8_str("a")
->Equals(env1.local(), result->Get(env1.local(), 1).ToLocalChecked())
.FromJust());
result =
Local<Array>::Cast(CompileRun("Object.getOwnPropertyNames(global2)"));

View File

@ -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(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include <limits.h>
#include "src/v8.h"
@ -43,7 +46,6 @@ using ::v8::Context;
using ::v8::Extension;
using ::v8::Function;
using ::v8::FunctionTemplate;
using ::v8::Handle;
using ::v8::HandleScope;
using ::v8::Local;
using ::v8::Message;
@ -59,21 +61,24 @@ using ::v8::Undefined;
using ::v8::V8;
using ::v8::Value;
static void ExpectBoolean(bool expected, Local<Value> result) {
static void ExpectBoolean(Local<Context> context, bool expected,
Local<Value> result) {
CHECK(result->IsBoolean());
CHECK_EQ(expected, result->BooleanValue());
CHECK_EQ(expected, result->BooleanValue(context).FromJust());
}
static void ExpectInt32(int32_t expected, Local<Value> result) {
static void ExpectInt32(Local<Context> context, int32_t expected,
Local<Value> result) {
CHECK(result->IsInt32());
CHECK_EQ(expected, result->Int32Value());
CHECK_EQ(expected, result->Int32Value(context).FromJust());
}
static void ExpectNumber(double expected, Local<Value> result) {
static void ExpectNumber(Local<Context> context, double expected,
Local<Value> result) {
CHECK(result->IsNumber());
CHECK_EQ(expected, result->NumberValue());
CHECK_EQ(expected, result->NumberValue(context).FromJust());
}
@ -88,7 +93,7 @@ TEST(simple_value) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
Local<Value> result = CompileRun("0x271828;");
ExpectInt32(0x271828, result);
ExpectInt32(env.local(), 0x271828, result);
}
@ -96,7 +101,7 @@ TEST(global_variable) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
Local<Value> result = CompileRun("var my_global_var = 0x123; my_global_var;");
ExpectInt32(0x123, result);
ExpectInt32(env.local(), 0x123, result);
}
@ -106,7 +111,7 @@ TEST(simple_function_call) {
Local<Value> result = CompileRun(
"function foo() { return 0x314; }"
"foo();");
ExpectInt32(0x314, result);
ExpectInt32(env.local(), 0x314, result);
}
@ -120,14 +125,12 @@ TEST(binary_op) {
" return 2 * (a + b - 1);"
"}"
"foo();");
ExpectInt32(0x2468, result);
ExpectInt32(env.local(), 0x2468, result);
}
static void if_comparison_testcontext_helper(
char const * op,
char const * lhs,
char const * rhs,
int expect) {
static void if_comparison_testcontext_helper(Local<Context> context,
char const* op, char const* lhs,
char const* rhs, int expect) {
char buffer[256];
snprintf(buffer, sizeof(buffer),
"var lhs = %s;"
@ -136,14 +139,12 @@ static void if_comparison_testcontext_helper(
"else { 0; }",
lhs, rhs, op);
Local<Value> result = CompileRun(buffer);
ExpectInt32(expect, result);
ExpectInt32(context, expect, result);
}
static void if_comparison_effectcontext_helper(
char const * op,
char const * lhs,
char const * rhs,
int expect) {
static void if_comparison_effectcontext_helper(Local<Context> context,
char const* op, char const* lhs,
char const* rhs, int expect) {
char buffer[256];
snprintf(buffer, sizeof(buffer),
"var lhs = %s;"
@ -153,23 +154,21 @@ static void if_comparison_effectcontext_helper(
"else { 0; }",
lhs, rhs, op);
Local<Value> result = CompileRun(buffer);
ExpectInt32(expect, result);
ExpectInt32(context, expect, result);
}
static void if_comparison_helper(
char const * op,
int expect_when_lt,
int expect_when_eq,
int expect_when_gt) {
static void if_comparison_helper(Local<Context> context, char const* op,
int expect_when_lt, int expect_when_eq,
int expect_when_gt) {
// TODO(all): Non-SMI tests.
if_comparison_testcontext_helper(op, "1", "3", expect_when_lt);
if_comparison_testcontext_helper(op, "5", "5", expect_when_eq);
if_comparison_testcontext_helper(op, "9", "7", expect_when_gt);
if_comparison_testcontext_helper(context, op, "1", "3", expect_when_lt);
if_comparison_testcontext_helper(context, op, "5", "5", expect_when_eq);
if_comparison_testcontext_helper(context, op, "9", "7", expect_when_gt);
if_comparison_effectcontext_helper(op, "1", "3", expect_when_lt);
if_comparison_effectcontext_helper(op, "5", "5", expect_when_eq);
if_comparison_effectcontext_helper(op, "9", "7", expect_when_gt);
if_comparison_effectcontext_helper(context, op, "1", "3", expect_when_lt);
if_comparison_effectcontext_helper(context, op, "5", "5", expect_when_eq);
if_comparison_effectcontext_helper(context, op, "9", "7", expect_when_gt);
}
@ -177,14 +176,14 @@ TEST(if_comparison) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
if_comparison_helper("<", 1, 0, 0);
if_comparison_helper("<=", 1, 1, 0);
if_comparison_helper("==", 0, 1, 0);
if_comparison_helper("===", 0, 1, 0);
if_comparison_helper(">=", 0, 1, 1);
if_comparison_helper(">", 0, 0, 1);
if_comparison_helper("!=", 1, 0, 1);
if_comparison_helper("!==", 1, 0, 1);
if_comparison_helper(env.local(), "<", 1, 0, 0);
if_comparison_helper(env.local(), "<=", 1, 1, 0);
if_comparison_helper(env.local(), "==", 0, 1, 0);
if_comparison_helper(env.local(), "===", 0, 1, 0);
if_comparison_helper(env.local(), ">=", 0, 1, 1);
if_comparison_helper(env.local(), ">", 0, 0, 1);
if_comparison_helper(env.local(), "!=", 1, 0, 1);
if_comparison_helper(env.local(), "!==", 1, 0, 1);
}
@ -194,19 +193,19 @@ TEST(unary_plus) {
Local<Value> result;
// SMI
result = CompileRun("var a = 1234; +a");
ExpectInt32(1234, result);
ExpectInt32(env.local(), 1234, result);
// Number
result = CompileRun("var a = 1234.5; +a");
ExpectNumber(1234.5, result);
ExpectNumber(env.local(), 1234.5, result);
// String (SMI)
result = CompileRun("var a = '1234'; +a");
ExpectInt32(1234, result);
ExpectInt32(env.local(), 1234, result);
// String (Number)
result = CompileRun("var a = '1234.5'; +a");
ExpectNumber(1234.5, result);
ExpectNumber(env.local(), 1234.5, result);
// Check side effects.
result = CompileRun("var a = 1234; +(a = 4321); a");
ExpectInt32(4321, result);
ExpectInt32(env.local(), 4321, result);
}
@ -215,15 +214,15 @@ TEST(unary_minus) {
v8::HandleScope scope(env->GetIsolate());
Local<Value> result;
result = CompileRun("var a = 1234; -a");
ExpectInt32(-1234, result);
ExpectInt32(env.local(), -1234, result);
result = CompileRun("var a = 1234.5; -a");
ExpectNumber(-1234.5, result);
ExpectNumber(env.local(), -1234.5, result);
result = CompileRun("var a = 1234; -(a = 4321); a");
ExpectInt32(4321, result);
ExpectInt32(env.local(), 4321, result);
result = CompileRun("var a = '1234'; -a");
ExpectInt32(-1234, result);
ExpectInt32(env.local(), -1234, result);
result = CompileRun("var a = '1234.5'; -a");
ExpectNumber(-1234.5, result);
ExpectNumber(env.local(), -1234.5, result);
}
@ -234,7 +233,7 @@ TEST(unary_void) {
result = CompileRun("var a = 1234; void (a);");
ExpectUndefined(result);
result = CompileRun("var a = 0; void (a = 42); a");
ExpectInt32(42, result);
ExpectInt32(env.local(), 42, result);
result = CompileRun("var a = 0; void (a = 42);");
ExpectUndefined(result);
}
@ -245,21 +244,21 @@ TEST(unary_not) {
v8::HandleScope scope(env->GetIsolate());
Local<Value> result;
result = CompileRun("var a = 1234; !a");
ExpectBoolean(false, result);
ExpectBoolean(env.local(), false, result);
result = CompileRun("var a = 0; !a");
ExpectBoolean(true, result);
ExpectBoolean(env.local(), true, result);
result = CompileRun("var a = 0; !(a = 1234); a");
ExpectInt32(1234, result);
ExpectInt32(env.local(), 1234, result);
result = CompileRun("var a = '1234'; !a");
ExpectBoolean(false, result);
ExpectBoolean(env.local(), false, result);
result = CompileRun("var a = ''; !a");
ExpectBoolean(true, result);
ExpectBoolean(env.local(), true, result);
result = CompileRun("var a = 1234; !!a");
ExpectBoolean(true, result);
ExpectBoolean(env.local(), true, result);
result = CompileRun("var a = 0; !!a");
ExpectBoolean(false, result);
ExpectBoolean(env.local(), false, result);
result = CompileRun("var a = 0; if ( !a ) { 1; } else { 0; }");
ExpectInt32(1, result);
ExpectInt32(env.local(), 1, result);
result = CompileRun("var a = 1; if ( !a ) { 1; } else { 0; }");
ExpectInt32(0, result);
ExpectInt32(env.local(), 0, result);
}

View File

@ -27,6 +27,9 @@
// Adapted from test/mjsunit/compiler/variables.js
// TODO(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include <limits.h>
#include "src/v8.h"
@ -45,7 +48,6 @@ using ::v8::Context;
using ::v8::Extension;
using ::v8::Function;
using ::v8::FunctionTemplate;
using ::v8::Handle;
using ::v8::HandleScope;
using ::v8::Local;
using ::v8::Message;
@ -61,9 +63,10 @@ using ::v8::Undefined;
using ::v8::V8;
using ::v8::Value;
static void ExpectInt32(int32_t expected, Local<Value> result) {
static void ExpectInt32(Local<Context> context, int32_t expected,
Local<Value> result) {
CHECK(result->IsInt32());
CHECK_EQ(expected, result->Int32Value());
CHECK_EQ(expected, result->Int32Value(context).FromJust());
}
@ -75,7 +78,7 @@ TEST(global_variables) {
"var x = 0;"
"function f0() { return x; }"
"f0();");
ExpectInt32(0, result);
ExpectInt32(env.local(), 0, result);
}
@ -86,7 +89,7 @@ TEST(parameters) {
Local<Value> result = CompileRun(
"function f1(x) { return x; }"
"f1(1);");
ExpectInt32(1, result);
ExpectInt32(env.local(), 1, result);
}
@ -97,7 +100,7 @@ TEST(stack_allocated_locals) {
Local<Value> result = CompileRun(
"function f2() { var x = 2; return x; }"
"f2();");
ExpectInt32(2, result);
ExpectInt32(env.local(), 2, result);
}
@ -111,7 +114,7 @@ TEST(context_allocated_locals) {
" return x;"
"}"
"f3(3);");
ExpectInt32(3, result);
ExpectInt32(env.local(), 3, result);
}
@ -125,7 +128,7 @@ TEST(read_from_outer_context) {
" return g();"
"}"
"f4(4);");
ExpectInt32(4, result);
ExpectInt32(env.local(), 4, result);
}
@ -138,5 +141,5 @@ TEST(lookup_slots) {
" with ({}) return x;"
"}"
"f5(5);");
ExpectInt32(5, result);
ExpectInt32(env.local(), 5, result);
}

View File

@ -27,6 +27,9 @@
//
// Tests of profiler-related functions from log.h
// TODO(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include <stdlib.h>
#include "src/v8.h"
@ -65,7 +68,8 @@ static bool IsAddressWithinFuncCode(JSFunction* function, Address addr) {
static bool IsAddressWithinFuncCode(v8::Local<v8::Context> context,
const char* func_name,
Address addr) {
v8::Local<v8::Value> func = context->Global()->Get(v8_str(func_name));
v8::Local<v8::Value> func =
context->Global()->Get(context, v8_str(func_name)).ToLocalChecked();
CHECK(func->IsFunction());
JSFunction* js_func = JSFunction::cast(*v8::Utils::OpenHandle(*func));
return IsAddressWithinFuncCode(js_func, addr);
@ -85,15 +89,18 @@ static void construct_call(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::StackFrame* calling_frame = frame_iterator.frame();
CHECK(calling_frame->is_java_script());
v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
#if defined(V8_HOST_ARCH_32_BIT)
int32_t low_bits = reinterpret_cast<int32_t>(calling_frame->fp());
args.This()->Set(v8_str("low_bits"), v8_num(low_bits >> 1));
args.This()
->Set(context, v8_str("low_bits"), v8_num(low_bits >> 1))
.FromJust();
#elif defined(V8_HOST_ARCH_64_BIT)
uint64_t fp = reinterpret_cast<uint64_t>(calling_frame->fp());
int32_t low_bits = static_cast<int32_t>(fp & 0xffffffff);
int32_t high_bits = static_cast<int32_t>(fp >> 32);
args.This()->Set(v8_str("low_bits"), v8_num(low_bits));
args.This()->Set(v8_str("high_bits"), v8_num(high_bits));
args.This()->Set(context, v8_str("low_bits"), v8_num(low_bits)).FromJust();
args.This()->Set(context, v8_str("high_bits"), v8_num(high_bits)).FromJust();
#else
#error Host architecture is neither 32-bit nor 64-bit.
#endif
@ -107,8 +114,9 @@ void CreateFramePointerGrabberConstructor(v8::Local<v8::Context> context,
Local<v8::FunctionTemplate> constructor_template =
v8::FunctionTemplate::New(context->GetIsolate(), construct_call);
constructor_template->SetClassName(v8_str("FPGrabber"));
Local<Function> fun = constructor_template->GetFunction();
context->Global()->Set(v8_str(constructor_name), fun);
Local<Function> fun =
constructor_template->GetFunction(context).ToLocalChecked();
context->Global()->Set(context, v8_str(constructor_name), fun).FromJust();
}

View File

@ -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(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include <stdlib.h>
#include <iostream> // NOLINT(readability/streams)
@ -142,8 +145,10 @@ static void TestNaN(const char *code) {
v8::Local<v8::Context> context = CcTest::NewContext(PRINT_EXTENSION);
v8::Context::Scope context_scope(context);
v8::Local<v8::Script> script = v8::Script::Compile(v8_str(code));
v8::Local<v8::Object> result = v8::Local<v8::Object>::Cast(script->Run());
v8::Local<v8::Script> script =
v8::Script::Compile(context, v8_str(code)).ToLocalChecked();
v8::Local<v8::Object> result =
v8::Local<v8::Object>::Cast(script->Run(context).ToLocalChecked());
i::Handle<i::JSReceiver> o = v8::Utils::OpenHandle(*result);
i::Handle<i::JSArray> array1(reinterpret_cast<i::JSArray*>(*o));
i::FixedDoubleArray* a = i::FixedDoubleArray::cast(array1->elements());

View File

@ -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(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include "src/v8.h"
#include "test/cctest/cctest.h"
@ -82,13 +85,20 @@ TEST(MicrotaskDeliverySimple) {
"});"
"Object.observe(obj, observer);"
"obj.id = 1;");
CHECK_EQ(6, 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(4, CompileRun("ordering[3]")->Int32Value());
CHECK_EQ(5, CompileRun("ordering[4]")->Int32Value());
CHECK_EQ(6, CompileRun("ordering[5]")->Int32Value());
CHECK_EQ(
6, CompileRun("ordering.length")->Int32Value(context.local()).FromJust());
CHECK_EQ(1,
CompileRun("ordering[0]")->Int32Value(context.local()).FromJust());
CHECK_EQ(2,
CompileRun("ordering[1]")->Int32Value(context.local()).FromJust());
CHECK_EQ(3,
CompileRun("ordering[2]")->Int32Value(context.local()).FromJust());
CHECK_EQ(4,
CompileRun("ordering[3]")->Int32Value(context.local()).FromJust());
CHECK_EQ(5,
CompileRun("ordering[4]")->Int32Value(context.local()).FromJust());
CHECK_EQ(6,
CompileRun("ordering[5]")->Int32Value(context.local()).FromJust());
}
@ -99,11 +109,16 @@ TEST(MicrotaskPerIsolateState) {
isolate.GetIsolate()->SetAutorunMicrotasks(false);
CompileRun(
"var obj = { calls: 0 };");
v8::Handle<v8::Value> obj = CompileRun("obj");
v8::Local<v8::Value> obj = CompileRun("obj");
{
LocalContext context2(isolate.GetIsolate());
context2->Global()->Set(
v8::String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj);
context2->Global()
->Set(context2.local(),
v8::String::NewFromUtf8(isolate.GetIsolate(), "obj",
v8::NewStringType::kNormal)
.ToLocalChecked(),
obj)
.FromJust();
CompileRun(
"var resolver = {};"
"new Promise(function(resolve) {"
@ -117,8 +132,13 @@ TEST(MicrotaskPerIsolateState) {
}
{
LocalContext context3(isolate.GetIsolate());
context3->Global()->Set(
v8::String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj);
context3->Global()
->Set(context3.local(),
v8::String::NewFromUtf8(isolate.GetIsolate(), "obj",
v8::NewStringType::kNormal)
.ToLocalChecked(),
obj)
.FromJust();
CompileRun(
"var foo = { id: 1 };"
"Object.observe(foo, function() {"
@ -128,9 +148,15 @@ TEST(MicrotaskPerIsolateState) {
}
{
LocalContext context4(isolate.GetIsolate());
context4->Global()->Set(
v8::String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj);
context4->Global()
->Set(context4.local(),
v8::String::NewFromUtf8(isolate.GetIsolate(), "obj",
v8::NewStringType::kNormal)
.ToLocalChecked(),
obj)
.FromJust();
isolate.GetIsolate()->RunMicrotasks();
CHECK_EQ(2, CompileRun("obj.calls")->Int32Value());
CHECK_EQ(2,
CompileRun("obj.calls")->Int32Value(context4.local()).FromJust());
}
}