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 } |
534 Address end = pc + decode_size; | 537 Address end = pc + decode_size; |
535 | 538 |
536 v8::internal::EmbeddedVector<char, 128> decode_buffer; | 539 v8::internal::EmbeddedVector<char, 128> decode_buffer; |
537 v8::internal::EmbeddedVector<char, 128> smi_hex_buffer; | 540 v8::internal::EmbeddedVector<char, 128> smi_hex_buffer; |
538 Smi* smi = Smi::FromInt(12345678); | 541 Smi* smi = Smi::FromInt(12345678); |
539 SNPrintF(smi_hex_buffer, "0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(smi)); | 542 SNPrintF(smi_hex_buffer, "0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(smi)); |
540 while (pc < end) { | 543 while (pc < end) { |
541 int num_const = d.ConstantPoolSizeAt(pc); | 544 int num_const = d.ConstantPoolSizeAt(pc); |
542 if (num_const >= 0) { | 545 if (num_const >= 0) { |
543 pc += (num_const + 1) * kPointerSize; | 546 pc += (num_const + 1) * kPointerSize; |
(...skipping 13 matching lines...) Expand all Loading... |
557 CompileRun("function f() { a = 12345678 }; f();"); | 560 CompileRun("function f() { a = 12345678 }; f();"); |
558 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 561 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
559 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 562 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
560 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 563 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
561 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 564 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
562 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 565 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
563 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 566 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
564 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 567 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
565 } | 568 } |
566 #endif | 569 #endif |
OLD | NEW |