OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/isolate.h" | 5 #include "src/isolate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 const int wasm_function_index = wasm_frame->function_index(); | 516 const int wasm_function_index = wasm_frame->function_index(); |
517 Code* code = wasm_frame->unchecked_code(); | 517 Code* code = wasm_frame->unchecked_code(); |
518 Handle<AbstractCode> abstract_code(AbstractCode::cast(code), this); | 518 Handle<AbstractCode> abstract_code(AbstractCode::cast(code), this); |
519 const int offset = | 519 const int offset = |
520 static_cast<int>(wasm_frame->pc() - code->instruction_start()); | 520 static_cast<int>(wasm_frame->pc() - code->instruction_start()); |
521 | 521 |
522 // TODO(wasm): The wasm object returned by the WasmFrame should always | 522 // TODO(wasm): The wasm object returned by the WasmFrame should always |
523 // be a wasm object. | 523 // be a wasm object. |
524 DCHECK(wasm::IsWasmInstance(*instance) || instance->IsUndefined(this)); | 524 DCHECK(wasm::IsWasmInstance(*instance) || instance->IsUndefined(this)); |
525 | 525 |
526 int flags = wasm::WasmIsAsmJs(*instance, this) | 526 int flags = 0; |
527 ? FrameArray::kIsAsmJsWasmFrame | 527 if (wasm::WasmIsAsmJs(*instance, this)) { |
528 : FrameArray::kIsWasmFrame; | 528 flags |= FrameArray::kIsAsmJsWasmFrame; |
| 529 if (wasm_frame->at_to_number_conversion()) { |
| 530 flags |= FrameArray::kAsmJsAtNumberConversion; |
| 531 } |
| 532 } else { |
| 533 flags |= FrameArray::kIsWasmFrame; |
| 534 } |
529 | 535 |
530 elements = | 536 elements = |
531 FrameArray::AppendWasmFrame(elements, instance, wasm_function_index, | 537 FrameArray::AppendWasmFrame(elements, instance, wasm_function_index, |
532 abstract_code, offset, flags); | 538 abstract_code, offset, flags); |
533 } break; | 539 } break; |
534 | 540 |
535 default: | 541 default: |
536 break; | 542 break; |
537 } | 543 } |
538 } | 544 } |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 continue; | 1556 continue; |
1551 } | 1557 } |
1552 | 1558 |
1553 if (elements->IsAsmJsWasmFrame(i)) { | 1559 if (elements->IsAsmJsWasmFrame(i)) { |
1554 Handle<WasmCompiledModule> compiled_module( | 1560 Handle<WasmCompiledModule> compiled_module( |
1555 WasmInstanceObject::cast(elements->WasmInstance(i)) | 1561 WasmInstanceObject::cast(elements->WasmInstance(i)) |
1556 ->get_compiled_module()); | 1562 ->get_compiled_module()); |
1557 int func_index = elements->WasmFunctionIndex(i)->value(); | 1563 int func_index = elements->WasmFunctionIndex(i)->value(); |
1558 int code_offset = elements->Offset(i)->value(); | 1564 int code_offset = elements->Offset(i)->value(); |
1559 int byte_pos = elements->Code(i)->SourcePosition(code_offset); | 1565 int byte_pos = elements->Code(i)->SourcePosition(code_offset); |
| 1566 bool at_to_number_conversion = |
| 1567 elements->Flags(i)->value() & FrameArray::kAsmJsAtNumberConversion; |
1560 int source_pos = WasmCompiledModule::GetAsmJsSourcePosition( | 1568 int source_pos = WasmCompiledModule::GetAsmJsSourcePosition( |
1561 compiled_module, func_index, byte_pos); | 1569 compiled_module, func_index, byte_pos, at_to_number_conversion); |
1562 Handle<Script> script = compiled_module->script(); | 1570 Handle<Script> script = compiled_module->script(); |
1563 | 1571 |
1564 *target = MessageLocation(script, source_pos, source_pos + 1); | 1572 *target = MessageLocation(script, source_pos, source_pos + 1); |
1565 return true; | 1573 return true; |
1566 } | 1574 } |
1567 | 1575 |
1568 Handle<JSFunction> fun = handle(elements->Function(i), this); | 1576 Handle<JSFunction> fun = handle(elements->Function(i), this); |
1569 if (!fun->shared()->IsSubjectToDebugging()) continue; | 1577 if (!fun->shared()->IsSubjectToDebugging()) continue; |
1570 | 1578 |
1571 Object* script = fun->shared()->script(); | 1579 Object* script = fun->shared()->script(); |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3030 | 3038 |
3031 int Isolate::GenerateIdentityHash(uint32_t mask) { | 3039 int Isolate::GenerateIdentityHash(uint32_t mask) { |
3032 int hash; | 3040 int hash; |
3033 int attempts = 0; | 3041 int attempts = 0; |
3034 do { | 3042 do { |
3035 hash = random_number_generator()->NextInt() & mask; | 3043 hash = random_number_generator()->NextInt() & mask; |
3036 } while (hash == 0 && attempts++ < 30); | 3044 } while (hash == 0 && attempts++ < 30); |
3037 return hash != 0 ? hash : 1; | 3045 return hash != 0 ? hash : 1; |
3038 } | 3046 } |
3039 | 3047 |
3040 Object* Isolate::FindCodeObject(Address a) { | 3048 Code* Isolate::FindCodeObject(Address a) { |
3041 return inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer(a); | 3049 return inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer(a); |
3042 } | 3050 } |
3043 | 3051 |
3044 | 3052 |
3045 #ifdef DEBUG | 3053 #ifdef DEBUG |
3046 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 3054 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
3047 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 3055 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
3048 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 3056 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
3049 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 3057 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
3050 #undef ISOLATE_FIELD_OFFSET | 3058 #undef ISOLATE_FIELD_OFFSET |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3535 // Then check whether this scope intercepts. | 3543 // Then check whether this scope intercepts. |
3536 if ((flag & intercept_mask_)) { | 3544 if ((flag & intercept_mask_)) { |
3537 intercepted_flags_ |= flag; | 3545 intercepted_flags_ |= flag; |
3538 return true; | 3546 return true; |
3539 } | 3547 } |
3540 return false; | 3548 return false; |
3541 } | 3549 } |
3542 | 3550 |
3543 } // namespace internal | 3551 } // namespace internal |
3544 } // namespace v8 | 3552 } // namespace v8 |
OLD | NEW |