| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } | 225 } |
| 226 | 226 |
| 227 | 227 |
| 228 // Tests calling a builtin function from C/C++ code, and the builtin function | 228 // Tests calling a builtin function from C/C++ code, and the builtin function |
| 229 // performs GC. It creates a stack frame looks like following: | 229 // performs GC. It creates a stack frame looks like following: |
| 230 // | C (PerformGC) | | 230 // | C (PerformGC) | |
| 231 // | JS-to-C | | 231 // | JS-to-C | |
| 232 // | JS | | 232 // | JS | |
| 233 // | C-to-JS | | 233 // | C-to-JS | |
| 234 TEST(C2JSFrames) { | 234 TEST(C2JSFrames) { |
| 235 FLAG_expose_gc = true; |
| 235 v8::HandleScope scope(CcTest::isolate()); | 236 v8::HandleScope scope(CcTest::isolate()); |
| 236 v8::Local<v8::Context> context = | 237 v8::Local<v8::Context> context = |
| 237 CcTest::NewContext(PRINT_EXTENSION | GC_EXTENSION); | 238 CcTest::NewContext(PRINT_EXTENSION | GC_EXTENSION); |
| 238 v8::Context::Scope context_scope(context); | 239 v8::Context::Scope context_scope(context); |
| 239 | 240 |
| 240 const char* source = "function foo(a) { gc(), print(a); }"; | 241 const char* source = "function foo(a) { gc(), print(a); }"; |
| 241 | 242 |
| 242 Handle<JSFunction> fun0 = Compile(source); | 243 Handle<JSFunction> fun0 = Compile(source); |
| 243 CHECK(!fun0.is_null()); | 244 CHECK(!fun0.is_null()); |
| 244 Isolate* isolate = fun0->GetIsolate(); | 245 Isolate* isolate = fun0->GetIsolate(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 CompileRun("function f() { a = 12345678 }; f();"); | 394 CompileRun("function f() { a = 12345678 }; f();"); |
| 394 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 395 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 395 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 396 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
| 396 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 397 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 397 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 398 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
| 398 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 399 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 399 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 400 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
| 400 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 401 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 401 } | 402 } |
| 402 #endif | 403 #endif |
| OLD | NEW |