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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 395 |
396 static void CheckCodeForUnsafeLiteral(Handle<JSFunction> f) { | 396 static void CheckCodeForUnsafeLiteral(Handle<JSFunction> f) { |
397 // Create a disassembler with default name lookup. | 397 // Create a disassembler with default name lookup. |
398 disasm::NameConverter name_converter; | 398 disasm::NameConverter name_converter; |
399 disasm::Disassembler d(name_converter); | 399 disasm::Disassembler d(name_converter); |
400 | 400 |
401 if (f->code()->kind() == Code::FUNCTION) { | 401 if (f->code()->kind() == Code::FUNCTION) { |
402 Address pc = f->code()->instruction_start(); | 402 Address pc = f->code()->instruction_start(); |
403 int decode_size = | 403 int decode_size = |
404 Min(f->code()->instruction_size(), | 404 Min(f->code()->instruction_size(), |
405 static_cast<int>(f->code()->stack_check_table_offset())); | 405 static_cast<int>(f->code()->back_edge_table_offset())); |
406 Address end = pc + decode_size; | 406 Address end = pc + decode_size; |
407 | 407 |
408 v8::internal::EmbeddedVector<char, 128> decode_buffer; | 408 v8::internal::EmbeddedVector<char, 128> decode_buffer; |
409 v8::internal::EmbeddedVector<char, 128> smi_hex_buffer; | 409 v8::internal::EmbeddedVector<char, 128> smi_hex_buffer; |
410 Smi* smi = Smi::FromInt(12345678); | 410 Smi* smi = Smi::FromInt(12345678); |
411 OS::SNPrintF(smi_hex_buffer, "0x%lx", reinterpret_cast<intptr_t>(smi)); | 411 OS::SNPrintF(smi_hex_buffer, "0x%lx", reinterpret_cast<intptr_t>(smi)); |
412 while (pc < end) { | 412 while (pc < end) { |
413 int num_const = d.ConstantPoolSizeAt(pc); | 413 int num_const = d.ConstantPoolSizeAt(pc); |
414 if (num_const >= 0) { | 414 if (num_const >= 0) { |
415 pc += (num_const + 1) * kPointerSize; | 415 pc += (num_const + 1) * kPointerSize; |
(...skipping 13 matching lines...) Expand all Loading... |
429 CompileRun("function f() { a = 12345678 }; f();"); | 429 CompileRun("function f() { a = 12345678 }; f();"); |
430 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 430 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
431 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 431 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
432 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 432 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
433 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 433 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
434 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 434 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
435 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 435 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
436 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 436 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
437 } | 437 } |
438 #endif | 438 #endif |
OLD | NEW |