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

Side by Side Diff: test/cctest/compiler/test-run-jscalls.cc

Issue 1668103002: Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 4 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
« no previous file with comments | « test/cctest/compiler/function-tester.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "test/cctest/compiler/function-tester.h" 5 #include "test/cctest/compiler/function-tester.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 // Disable context specialization. 208 // Disable context specialization.
209 FunctionTester T(script); 209 FunctionTester T(script);
210 v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); 210 v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
211 v8::Context::Scope scope(context); 211 v8::Context::Scope scope(context);
212 v8::Local<v8::Value> value = CompileRun(script); 212 v8::Local<v8::Value> value = CompileRun(script);
213 i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value); 213 i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value);
214 i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun); 214 i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun);
215 jsfun->set_code(T.function->code()); 215 jsfun->set_code(T.function->code());
216 jsfun->set_shared(T.function->shared()); 216 jsfun->set_shared(T.function->shared());
217 jsfun->set_literals(T.function->literals());
217 CHECK(context->Global() 218 CHECK(context->Global()
218 ->Set(context, v8_str("foo"), v8::Utils::CallableToLocal(jsfun)) 219 ->Set(context, v8_str("foo"), v8::Utils::CallableToLocal(jsfun))
219 .FromJust()); 220 .FromJust());
220 CompileRun("var x = 24;"); 221 CompileRun("var x = 24;");
221 ExpectInt32("foo();", 24); 222 ExpectInt32("foo();", 24);
222 } 223 }
223 224
224 225
225 TEST(BuiltinLoadedFromActivation) { 226 TEST(BuiltinLoadedFromActivation) {
226 const char* script = 227 const char* script =
227 "var x = 42;" 228 "var x = 42;"
228 "(function() {" 229 "(function() {"
229 " return function () { return this; };" 230 " return function () { return this; };"
230 "})()"; 231 "})()";
231 232
232 // Disable context specialization. 233 // Disable context specialization.
233 FunctionTester T(script); 234 FunctionTester T(script);
234 v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); 235 v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate());
235 v8::Context::Scope scope(context); 236 v8::Context::Scope scope(context);
236 v8::Local<v8::Value> value = CompileRun(script); 237 v8::Local<v8::Value> value = CompileRun(script);
237 i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value); 238 i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value);
238 i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun); 239 i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun);
239 jsfun->set_code(T.function->code()); 240 jsfun->set_code(T.function->code());
240 jsfun->set_shared(T.function->shared()); 241 jsfun->set_shared(T.function->shared());
242 jsfun->set_literals(T.function->literals());
241 CHECK(context->Global() 243 CHECK(context->Global()
242 ->Set(context, v8_str("foo"), v8::Utils::CallableToLocal(jsfun)) 244 ->Set(context, v8_str("foo"), v8::Utils::CallableToLocal(jsfun))
243 .FromJust()); 245 .FromJust());
244 CompileRun("var x = 24;"); 246 CompileRun("var x = 24;");
245 ExpectObject("foo()", context->Global()); 247 ExpectObject("foo()", context->Global());
246 } 248 }
247 249
248 } // namespace compiler 250 } // namespace compiler
249 } // namespace internal 251 } // namespace internal
250 } // namespace v8 252 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/function-tester.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698