Chromium Code Reviews| Index: test/cctest/compiler/function-tester.h |
| diff --git a/test/cctest/compiler/function-tester.h b/test/cctest/compiler/function-tester.h |
| index 2ed2fe99883da65ae29d0c40ef287d40b1b41ed0..6568fc7679a35e279502a117de97200a20268c56 100644 |
| --- a/test/cctest/compiler/function-tester.h |
| +++ b/test/cctest/compiler/function-tester.h |
| @@ -24,16 +24,25 @@ namespace v8 { |
| namespace internal { |
| namespace compiler { |
| +static void AssertStackDepth(const v8::FunctionCallbackInfo<v8::Value>& args) { |
|
Michael Starzinger
2014/08/12 20:04:46
All of this machinery is pretty specific to inlini
sigurds
2014/08/14 09:54:42
Done.
|
| + v8::HandleScope scope(args.GetIsolate()); |
| + v8::Handle<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace( |
| + args.GetIsolate(), 10, v8::StackTrace::kDetailed); |
| + CHECK_EQ(args[0]->ToInt32()->Value(), stackTrace->GetFrameCount()); |
| +} |
| + |
| class FunctionTester : public InitializedHandleScope { |
| public: |
| explicit FunctionTester(const char* source) |
| - : isolate(main_isolate()), |
| - function((FLAG_allow_natives_syntax = true, NewFunction(source))) { |
| + : isolate(main_isolate()), context(0, GetObjectTemplate()) { |
| + FLAG_allow_natives_syntax = true; |
| + function = NewFunction(source); |
| Compile(function); |
| } |
| Isolate* isolate; |
| Handle<JSFunction> function; |
| + LocalContext context; |
| Handle<JSFunction> Compile(Handle<JSFunction> function) { |
| #if V8_TURBOFAN_TARGET |
| @@ -70,6 +79,13 @@ class FunctionTester : public InitializedHandleScope { |
| return function; |
| } |
| + Local<ObjectTemplate> GetObjectTemplate() { |
| + Local<ObjectTemplate> templ = ObjectTemplate::New(CcTest::isolate()); |
| + templ->Set(v8_str("AssertStackDepth"), |
| + v8::FunctionTemplate::New(CcTest::isolate(), AssertStackDepth)); |
| + return templ; |
| + } |
| + |
| static void EnsureDeoptimizationSupport(CompilationInfo* info) { |
| bool should_recompile = !info->shared_info()->has_deoptimization_support(); |
| if (should_recompile) { |