| 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 static void CheckCodeForUnsafeLiteral(Handle<JSFunction> f) { | 524 static void CheckCodeForUnsafeLiteral(Handle<JSFunction> f) { |
| 525 // Create a disassembler with default name lookup. | 525 // Create a disassembler with default name lookup. |
| 526 disasm::NameConverter name_converter; | 526 disasm::NameConverter name_converter; |
| 527 disasm::Disassembler d(name_converter); | 527 disasm::Disassembler d(name_converter); |
| 528 | 528 |
| 529 if (f->code()->kind() == Code::FUNCTION) { | 529 if (f->code()->kind() == Code::FUNCTION) { |
| 530 Address pc = f->code()->instruction_start(); | 530 Address pc = f->code()->instruction_start(); |
| 531 int decode_size = | 531 int decode_size = |
| 532 Min(f->code()->instruction_size(), | 532 Min(f->code()->instruction_size(), |
| 533 static_cast<int>(f->code()->back_edge_table_offset())); | 533 static_cast<int>(f->code()->back_edge_table_offset())); |
| 534 if (FLAG_enable_embedded_constant_pool) { | |
| 535 decode_size = Min(decode_size, f->code()->constant_pool_offset()); | |
| 536 } | |
| 537 Address end = pc + decode_size; | 534 Address end = pc + decode_size; |
| 538 | 535 |
| 539 v8::internal::EmbeddedVector<char, 128> decode_buffer; | 536 v8::internal::EmbeddedVector<char, 128> decode_buffer; |
| 540 v8::internal::EmbeddedVector<char, 128> smi_hex_buffer; | 537 v8::internal::EmbeddedVector<char, 128> smi_hex_buffer; |
| 541 Smi* smi = Smi::FromInt(12345678); | 538 Smi* smi = Smi::FromInt(12345678); |
| 542 SNPrintF(smi_hex_buffer, "0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(smi)); | 539 SNPrintF(smi_hex_buffer, "0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(smi)); |
| 543 while (pc < end) { | 540 while (pc < end) { |
| 544 int num_const = d.ConstantPoolSizeAt(pc); | 541 int num_const = d.ConstantPoolSizeAt(pc); |
| 545 if (num_const >= 0) { | 542 if (num_const >= 0) { |
| 546 pc += (num_const + 1) * kPointerSize; | 543 pc += (num_const + 1) * kPointerSize; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 560 CompileRun("function f() { a = 12345678 }; f();"); | 557 CompileRun("function f() { a = 12345678 }; f();"); |
| 561 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 558 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 562 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 559 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
| 563 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 560 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 564 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 561 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
| 565 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 562 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 566 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 563 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
| 567 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 564 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 568 } | 565 } |
| 569 #endif | 566 #endif |
| OLD | NEW |