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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 310 |
311 // Regression 236. Calling InitLineEnds on a Script with undefined | 311 // Regression 236. Calling InitLineEnds on a Script with undefined |
312 // source resulted in crash. | 312 // source resulted in crash. |
313 TEST(Regression236) { | 313 TEST(Regression236) { |
314 CcTest::InitializeVM(); | 314 CcTest::InitializeVM(); |
315 Isolate* isolate = CcTest::i_isolate(); | 315 Isolate* isolate = CcTest::i_isolate(); |
316 Factory* factory = isolate->factory(); | 316 Factory* factory = isolate->factory(); |
317 v8::HandleScope scope(CcTest::isolate()); | 317 v8::HandleScope scope(CcTest::isolate()); |
318 | 318 |
319 Handle<Script> script = factory->NewScript(factory->empty_string()); | 319 Handle<Script> script = factory->NewScript(factory->empty_string()); |
320 script->set_source(HEAP->undefined_value()); | 320 script->set_source(CcTest::heap()->undefined_value()); |
321 CHECK_EQ(-1, GetScriptLineNumber(script, 0)); | 321 CHECK_EQ(-1, GetScriptLineNumber(script, 0)); |
322 CHECK_EQ(-1, GetScriptLineNumber(script, 100)); | 322 CHECK_EQ(-1, GetScriptLineNumber(script, 100)); |
323 CHECK_EQ(-1, GetScriptLineNumber(script, -1)); | 323 CHECK_EQ(-1, GetScriptLineNumber(script, -1)); |
324 } | 324 } |
325 | 325 |
326 | 326 |
327 TEST(GetScriptLineNumber) { | 327 TEST(GetScriptLineNumber) { |
328 CcTest::InitializeVM(); | 328 CcTest::InitializeVM(); |
329 v8::HandleScope scope(CcTest::isolate()); | 329 v8::HandleScope scope(CcTest::isolate()); |
330 v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test")); | 330 v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test")); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 CompileRun("function f() { a = 12345678 }; f();"); | 426 CompileRun("function f() { a = 12345678 }; f();"); |
427 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); | 427 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); |
428 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 428 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
429 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); | 429 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); |
430 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 430 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
431 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); | 431 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); |
432 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 432 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
433 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); | 433 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); |
434 } | 434 } |
435 #endif | 435 #endif |
OLD | NEW |