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

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

Issue 2655223003: Revert of [tests] Make assertOptimized()/assertUnoptimized() great again. (Closed)
Patch Set: Created 3 years, 10 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"
17 #include "src/unicode-inl.h" 16 #include "src/unicode-inl.h"
18 #include "src/utils.h" 17 #include "src/utils.h"
19 18
20 using ::v8::Boolean; 19 using ::v8::Boolean;
21 using ::v8::BooleanObject; 20 using ::v8::BooleanObject;
22 using ::v8::Context; 21 using ::v8::Context;
23 using ::v8::Extension; 22 using ::v8::Extension;
24 using ::v8::Function; 23 using ::v8::Function;
25 using ::v8::FunctionTemplate; 24 using ::v8::FunctionTemplate;
26 using ::v8::HandleScope; 25 using ::v8::HandleScope;
(...skipping 4060 matching lines...) Expand 10 before | Expand all | Expand 10 after
4087 .ToLocalChecked() 4086 .ToLocalChecked()
4088 ->NewInstance(env.local()) 4087 ->NewInstance(env.local())
4089 .ToLocalChecked()) 4088 .ToLocalChecked())
4090 .FromJust(); 4089 .FromJust();
4091 ExpectTrue("obj.x === 42"); 4090 ExpectTrue("obj.x === 42");
4092 ExpectTrue("!obj.propertyIsEnumerable('x')"); 4091 ExpectTrue("!obj.propertyIsEnumerable('x')");
4093 } 4092 }
4094 4093
4095 4094
4096 THREADED_TEST(Regress256330) { 4095 THREADED_TEST(Regress256330) {
4097 if (!i::FLAG_crankshaft) return;
4098 i::FLAG_allow_natives_syntax = true; 4096 i::FLAG_allow_natives_syntax = true;
4099 LocalContext context; 4097 LocalContext context;
4100 v8::HandleScope scope(context->GetIsolate()); 4098 v8::HandleScope scope(context->GetIsolate());
4101 Local<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate()); 4099 Local<FunctionTemplate> templ = FunctionTemplate::New(context->GetIsolate());
4102 AddInterceptor(templ, InterceptorGetter, InterceptorSetter); 4100 AddInterceptor(templ, InterceptorGetter, InterceptorSetter);
4103 context->Global() 4101 context->Global()
4104 ->Set(context.local(), v8_str("Bug"), 4102 ->Set(context.local(), v8_str("Bug"),
4105 templ->GetFunction(context.local()).ToLocalChecked()) 4103 templ->GetFunction(context.local()).ToLocalChecked())
4106 .FromJust(); 4104 .FromJust();
4107 CompileRun( 4105 CompileRun(
4108 "\"use strict\"; var o = new Bug;" 4106 "\"use strict\"; var o = new Bug;"
4109 "function f(o) { o.x = 10; };" 4107 "function f(o) { o.x = 10; };"
4110 "f(o); f(o); f(o);" 4108 "f(o); f(o); f(o);"
4111 "%OptimizeFunctionOnNextCall(f);" 4109 "%OptimizeFunctionOnNextCall(f);"
4112 "f(o);"); 4110 "f(o);");
4113 int status = v8_run_int32value(v8_compile("%GetOptimizationStatus(f)")); 4111 ExpectBoolean("%GetOptimizationStatus(f) != 2", true);
4114 int mask = static_cast<int>(i::OptimizationStatus::kIsFunction) |
4115 static_cast<int>(i::OptimizationStatus::kOptimized);
4116 CHECK_EQ(mask, status & mask);
4117 } 4112 }
4118 4113
4119 4114
4120 THREADED_TEST(CrankshaftInterceptorSetter) { 4115 THREADED_TEST(CrankshaftInterceptorSetter) {
4121 i::FLAG_allow_natives_syntax = true; 4116 i::FLAG_allow_natives_syntax = true;
4122 v8::HandleScope scope(CcTest::isolate()); 4117 v8::HandleScope scope(CcTest::isolate());
4123 Local<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate()); 4118 Local<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
4124 AddInterceptor(templ, InterceptorGetter, InterceptorSetter); 4119 AddInterceptor(templ, InterceptorGetter, InterceptorSetter);
4125 LocalContext env; 4120 LocalContext env;
4126 env->Global() 4121 env->Global()
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
4917 ->Set(env.local(), v8_str("Fun"), 4912 ->Set(env.local(), v8_str("Fun"),
4918 fun_templ->GetFunction(env.local()).ToLocalChecked()) 4913 fun_templ->GetFunction(env.local()).ToLocalChecked())
4919 .FromJust()); 4914 .FromJust());
4920 4915
4921 CompileRun( 4916 CompileRun(
4922 "var f = new Fun();" 4917 "var f = new Fun();"
4923 "Number.prototype.__proto__ = f;" 4918 "Number.prototype.__proto__ = f;"
4924 "var a = 42;" 4919 "var a = 42;"
4925 "for (var i = 0; i<3; i++) { a.foo; }"); 4920 "for (var i = 0; i<3; i++) { a.foo; }");
4926 } 4921 }
OLDNEW
« no previous file with comments | « src/runtime/runtime-test.cc ('k') | test/debugger/debug/regress/regress-prepare-break-while-recompile.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698