| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 const char function_f[] = "function f() {}"; | 323 const char function_f[] = "function f() {}"; |
| 324 const int max_rows = 1000; | 324 const int max_rows = 1000; |
| 325 const int buffer_size = max_rows + sizeof(function_f); | 325 const int buffer_size = max_rows + sizeof(function_f); |
| 326 ScopedVector<char> buffer(buffer_size); | 326 ScopedVector<char> buffer(buffer_size); |
| 327 memset(buffer.start(), '\n', buffer_size - 1); | 327 memset(buffer.start(), '\n', buffer_size - 1); |
| 328 buffer[buffer_size - 1] = '\0'; | 328 buffer[buffer_size - 1] = '\0'; |
| 329 | 329 |
| 330 for (int i = 0; i < max_rows; ++i) { | 330 for (int i = 0; i < max_rows; ++i) { |
| 331 if (i > 0) | 331 if (i > 0) |
| 332 buffer[i - 1] = '\n'; | 332 buffer[i - 1] = '\n'; |
| 333 memcpy(&buffer[i], function_f, sizeof(function_f) - 1); | 333 OS::MemCopy(&buffer[i], function_f, sizeof(function_f) - 1); |
| 334 v8::Handle<v8::String> script_body = v8::String::New(buffer.start()); | 334 v8::Handle<v8::String> script_body = v8::String::New(buffer.start()); |
| 335 v8::Script::Compile(script_body, &origin)->Run(); | 335 v8::Script::Compile(script_body, &origin)->Run(); |
| 336 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast( | 336 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast( |
| 337 CcTest::env()->Global()->Get(v8::String::New("f"))); | 337 CcTest::env()->Global()->Get(v8::String::New("f"))); |
| 338 CHECK_EQ(i, f->GetScriptLineNumber()); | 338 CHECK_EQ(i, f->GetScriptLineNumber()); |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 | 341 |
| 342 | 342 |
| 343 // Test that optimized code for different closures is actually shared | 343 // Test that optimized code for different closures is actually shared |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 CompileRun("function f() { a = 12345678 }; f();"); | 417 CompileRun("function f() { a = 12345678 }; f();"); |
| 418 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); | 418 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); |
| 419 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 419 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
| 420 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); | 420 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); |
| 421 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 421 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
| 422 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); | 422 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); |
| 423 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 423 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
| 424 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); | 424 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); |
| 425 } | 425 } |
| 426 #endif | 426 #endif |
| OLD | NEW |