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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 const char* source = "function foo(a) { gc(), print(a); }"; | 220 const char* source = "function foo(a) { gc(), print(a); }"; |
221 | 221 |
222 Handle<JSFunction> fun0 = Compile(source); | 222 Handle<JSFunction> fun0 = Compile(source); |
223 CHECK(!fun0.is_null()); | 223 CHECK(!fun0.is_null()); |
224 Isolate* isolate = fun0->GetIsolate(); | 224 Isolate* isolate = fun0->GetIsolate(); |
225 | 225 |
226 // Run the generated code to populate the global object with 'foo'. | 226 // Run the generated code to populate the global object with 'foo'. |
227 Handle<JSObject> global(isolate->context()->global_object()); | 227 Handle<JSObject> global(isolate->context()->global_object()); |
228 Execution::Call(isolate, fun0, global, 0, NULL).Check(); | 228 Execution::Call(isolate, fun0, global, 0, NULL).Check(); |
229 | 229 |
230 Handle<String> foo_string = isolate->factory()->InternalizeOneByteString( | 230 Handle<String> foo_string = |
231 STATIC_ASCII_VECTOR("foo")); | 231 isolate->factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("foo")); |
232 Handle<Object> fun1 = Object::GetProperty( | 232 Handle<Object> fun1 = Object::GetProperty( |
233 isolate->global_object(), foo_string).ToHandleChecked(); | 233 isolate->global_object(), foo_string).ToHandleChecked(); |
234 CHECK(fun1->IsJSFunction()); | 234 CHECK(fun1->IsJSFunction()); |
235 | 235 |
236 Handle<Object> argv[] = { isolate->factory()->InternalizeOneByteString( | 236 Handle<Object> argv[] = {isolate->factory()->InternalizeOneByteString( |
237 STATIC_ASCII_VECTOR("hello")) }; | 237 STATIC_CHAR_VECTOR("hello"))}; |
238 Execution::Call(isolate, | 238 Execution::Call(isolate, |
239 Handle<JSFunction>::cast(fun1), | 239 Handle<JSFunction>::cast(fun1), |
240 global, | 240 global, |
241 arraysize(argv), | 241 arraysize(argv), |
242 argv).Check(); | 242 argv).Check(); |
243 } | 243 } |
244 | 244 |
245 | 245 |
246 // Regression 236. Calling InitLineEnds on a Script with undefined | 246 // Regression 236. Calling InitLineEnds on a Script with undefined |
247 // source resulted in crash. | 247 // source resulted in crash. |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 CompileRun("function f() { a = 12345678 }; f();"); | 440 CompileRun("function f() { a = 12345678 }; f();"); |
441 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 441 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
442 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 442 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
443 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 443 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
444 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 444 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
445 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 445 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
446 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 446 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
447 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 447 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
448 } | 448 } |
449 #endif | 449 #endif |
OLD | NEW |