OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 Address pc = f->code()->instruction_start(); | 370 Address pc = f->code()->instruction_start(); |
371 int decode_size = | 371 int decode_size = |
372 Min(f->code()->instruction_size(), | 372 Min(f->code()->instruction_size(), |
373 static_cast<int>(f->code()->stack_check_table_offset())); | 373 static_cast<int>(f->code()->stack_check_table_offset())); |
374 Address end = pc + decode_size; | 374 Address end = pc + decode_size; |
375 | 375 |
376 v8::internal::EmbeddedVector<char, 128> decode_buffer; | 376 v8::internal::EmbeddedVector<char, 128> decode_buffer; |
377 while (pc < end) { | 377 while (pc < end) { |
378 int num_const = d.ConstantPoolSizeAt(pc); | 378 int num_const = d.ConstantPoolSizeAt(pc); |
379 if (num_const >= 0) { | 379 if (num_const >= 0) { |
380 pc += num_const * kPointerSize; | 380 pc += (num_const + 1) * kPointerSize; |
381 } else { | 381 } else { |
382 pc += d.InstructionDecode(decode_buffer, pc); | 382 pc += d.InstructionDecode(decode_buffer, pc); |
383 CHECK(strstr(decode_buffer.start(), "mov eax,0x178c29c") == NULL); | 383 CHECK(strstr(decode_buffer.start(), "mov eax,0x178c29c") == NULL); |
384 CHECK(strstr(decode_buffer.start(), "push 0x178c29c") == NULL); | 384 CHECK(strstr(decode_buffer.start(), "push 0x178c29c") == NULL); |
385 CHECK(strstr(decode_buffer.start(), "0x178c29c") == NULL); | 385 CHECK(strstr(decode_buffer.start(), "0x178c29c") == NULL); |
386 } | 386 } |
387 } | 387 } |
388 } | 388 } |
389 } | 389 } |
390 | 390 |
391 | 391 |
392 TEST(SplitConstantsInFullCompiler) { | 392 TEST(SplitConstantsInFullCompiler) { |
393 v8::HandleScope scope; | 393 v8::HandleScope scope; |
394 LocalContext env; | 394 LocalContext env; |
395 | 395 |
396 CompileRun("function f() { a = 12345678 }; f();"); | 396 CompileRun("function f() { a = 12345678 }; f();"); |
397 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 397 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
398 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 398 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
399 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 399 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
400 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 400 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
401 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 401 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
402 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 402 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
403 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 403 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
404 } | 404 } |
405 #endif | 405 #endif |
OLD | NEW |