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

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

Issue 2654733004: [tests] Make assertOptimized()/assertUnoptimized() great again. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "test/cctest/test-api.h" 7 #include "test/cctest/test-api.h"
8 8
9 #include "include/v8-util.h" 9 #include "include/v8-util.h"
10 #include "src/api.h" 10 #include "src/api.h"
11 #include "src/arguments.h" 11 #include "src/arguments.h"
12 #include "src/base/platform/platform.h" 12 #include "src/base/platform/platform.h"
13 #include "src/compilation-cache.h" 13 #include "src/compilation-cache.h"
14 #include "src/execution.h" 14 #include "src/execution.h"
15 #include "src/objects.h" 15 #include "src/objects.h"
16 #include "src/runtime/runtime.h"
16 #include "src/unicode-inl.h" 17 #include "src/unicode-inl.h"
17 #include "src/utils.h" 18 #include "src/utils.h"
18 19
19 using ::v8::Boolean; 20 using ::v8::Boolean;
20 using ::v8::BooleanObject; 21 using ::v8::BooleanObject;
21 using ::v8::Context; 22 using ::v8::Context;
22 using ::v8::Extension; 23 using ::v8::Extension;
23 using ::v8::Function; 24 using ::v8::Function;
24 using ::v8::FunctionTemplate; 25 using ::v8::FunctionTemplate;
25 using ::v8::HandleScope; 26 using ::v8::HandleScope;
(...skipping 4075 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 context->Global() 4102 context->Global()
4102 ->Set(context.local(), v8_str("Bug"), 4103 ->Set(context.local(), v8_str("Bug"),
4103 templ->GetFunction(context.local()).ToLocalChecked()) 4104 templ->GetFunction(context.local()).ToLocalChecked())
4104 .FromJust(); 4105 .FromJust();
4105 CompileRun( 4106 CompileRun(
4106 "\"use strict\"; var o = new Bug;" 4107 "\"use strict\"; var o = new Bug;"
4107 "function f(o) { o.x = 10; };" 4108 "function f(o) { o.x = 10; };"
4108 "f(o); f(o); f(o);" 4109 "f(o); f(o); f(o);"
4109 "%OptimizeFunctionOnNextCall(f);" 4110 "%OptimizeFunctionOnNextCall(f);"
4110 "f(o);"); 4111 "f(o);");
4111 ExpectBoolean("%GetOptimizationStatus(f) != 2", true); 4112 int status = v8_run_int32value(v8_compile("%GetOptimizationStatus(f)"));
4113 int mask = static_cast<int>(i::OptimizationStatus::kIsOptmimizedFunctionMask);
4114 CHECK_EQ(mask, status & mask);
4112 } 4115 }
4113 4116
4114 4117
4115 THREADED_TEST(CrankshaftInterceptorSetter) { 4118 THREADED_TEST(CrankshaftInterceptorSetter) {
4116 i::FLAG_allow_natives_syntax = true; 4119 i::FLAG_allow_natives_syntax = true;
4117 v8::HandleScope scope(CcTest::isolate()); 4120 v8::HandleScope scope(CcTest::isolate());
4118 Local<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate()); 4121 Local<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
4119 AddInterceptor(templ, InterceptorGetter, InterceptorSetter); 4122 AddInterceptor(templ, InterceptorGetter, InterceptorSetter);
4120 LocalContext env; 4123 LocalContext env;
4121 env->Global() 4124 env->Global()
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
4912 ->Set(env.local(), v8_str("Fun"), 4915 ->Set(env.local(), v8_str("Fun"),
4913 fun_templ->GetFunction(env.local()).ToLocalChecked()) 4916 fun_templ->GetFunction(env.local()).ToLocalChecked())
4914 .FromJust()); 4917 .FromJust());
4915 4918
4916 CompileRun( 4919 CompileRun(
4917 "var f = new Fun();" 4920 "var f = new Fun();"
4918 "Number.prototype.__proto__ = f;" 4921 "Number.prototype.__proto__ = f;"
4919 "var a = 42;" 4922 "var a = 42;"
4920 "for (var i = 0; i<3; i++) { a.foo; }"); 4923 "for (var i = 0; i<3; i++) { a.foo; }");
4921 } 4924 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698