| 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 | 545 |
| 546 // When generating debug code, make sure the lexical context is set. | 546 // When generating debug code, make sure the lexical context is set. |
| 547 if (FLAG_debug_code) { | 547 if (FLAG_debug_code) { |
| 548 cmp(Operand(scratch), Immediate(0)); | 548 cmp(Operand(scratch), Immediate(0)); |
| 549 Check(not_equal, "we should not have an empty lexical context"); | 549 Check(not_equal, "we should not have an empty lexical context"); |
| 550 } | 550 } |
| 551 // Load the global context of the current context. | 551 // Load the global context of the current context. |
| 552 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; | 552 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
| 553 mov(scratch, FieldOperand(scratch, offset)); | 553 mov(scratch, FieldOperand(scratch, offset)); |
| 554 mov(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); | 554 mov(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); |
| 555 | 555 |
| 556 // Check the context is a global context. | 556 // Check the context is a global context. |
| 557 if (FLAG_debug_code) { | 557 if (FLAG_debug_code) { |
| 558 push(scratch); | 558 push(scratch); |
| 559 // Read the first word and compare to global_context_map. | 559 // Read the first word and compare to global_context_map. |
| 560 mov(scratch, FieldOperand(scratch, HeapObject::kMapOffset)); | 560 mov(scratch, FieldOperand(scratch, HeapObject::kMapOffset)); |
| 561 cmp(scratch, Factory::global_context_map()); | 561 cmp(scratch, Factory::global_context_map()); |
| 562 Check(equal, "JSGlobalObject::global_context should be a global context."); | 562 Check(equal, "JSGlobalObject::global_context should be a global context."); |
| 563 pop(scratch); | 563 pop(scratch); |
| 564 } | 564 } |
| 565 | 565 |
| 566 // Check if both contexts are the same. | 566 // Check if both contexts are the same. |
| 567 cmp(scratch, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 567 cmp(scratch, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
| 568 j(equal, &same_contexts, taken); | 568 j(equal, &same_contexts, taken); |
| 569 | 569 |
| 570 // Compare security tokens, save holder_reg on the stack so we can use it | 570 // Compare security tokens, save holder_reg on the stack so we can use it |
| 571 // as a temporary register. | 571 // as a temporary register. |
| 572 // | 572 // |
| 573 // TODO(119): avoid push(holder_reg)/pop(holder_reg) | 573 // TODO(119): avoid push(holder_reg)/pop(holder_reg) |
| 574 push(holder_reg); | 574 push(holder_reg); |
| 575 // Check that the security token in the calling global object is | 575 // Check that the security token in the calling global object is |
| 576 // compatible with the security token in the receiving global | 576 // compatible with the security token in the receiving global |
| 577 // object. | 577 // object. |
| 578 mov(holder_reg, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 578 mov(holder_reg, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
| 579 | 579 |
| 580 // Check the context is a global context. | 580 // Check the context is a global context. |
| 581 if (FLAG_debug_code) { | 581 if (FLAG_debug_code) { |
| 582 cmp(holder_reg, Factory::null_value()); | 582 cmp(holder_reg, Factory::null_value()); |
| 583 Check(not_equal, "JSGlobalProxy::context() should not be null."); | 583 Check(not_equal, "JSGlobalProxy::context() should not be null."); |
| 584 | 584 |
| 585 push(holder_reg); | 585 push(holder_reg); |
| 586 // Read the first word and compare to global_context_map(), | 586 // Read the first word and compare to global_context_map(), |
| 587 mov(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset)); | 587 mov(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset)); |
| 588 cmp(holder_reg, Factory::global_context_map()); | 588 cmp(holder_reg, Factory::global_context_map()); |
| 589 Check(equal, "JSGlobalObject::global_context should be a global context."); | 589 Check(equal, "JSGlobalObject::global_context should be a global context."); |
| 590 pop(holder_reg); | 590 pop(holder_reg); |
| 591 } | 591 } |
| 592 | 592 |
| 593 int token_offset = Context::kHeaderSize + | 593 int token_offset = Context::kHeaderSize + |
| 594 Context::SECURITY_TOKEN_INDEX * kPointerSize; | 594 Context::SECURITY_TOKEN_INDEX * kPointerSize; |
| 595 mov(scratch, FieldOperand(scratch, token_offset)); | 595 mov(scratch, FieldOperand(scratch, token_offset)); |
| 596 cmp(scratch, FieldOperand(holder_reg, token_offset)); | 596 cmp(scratch, FieldOperand(holder_reg, token_offset)); |
| 597 pop(holder_reg); | 597 pop(holder_reg); |
| 598 j(not_equal, miss, not_taken); | 598 j(not_equal, miss, not_taken); |
| 599 | 599 |
| 600 bind(&same_contexts); | 600 bind(&same_contexts); |
| 601 } | 601 } |
| 602 | 602 |
| 603 | 603 |
| 604 void MacroAssembler::NegativeZeroTest(Register result, | 604 void MacroAssembler::NegativeZeroTest(Register result, |
| 605 Register op, | 605 Register op, |
| 606 Label* then_label) { | 606 Label* then_label) { |
| 607 Label ok; | 607 Label ok; |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 // Indicate that code has changed. | 1005 // Indicate that code has changed. |
| 1006 CPU::FlushICache(address_, size_); | 1006 CPU::FlushICache(address_, size_); |
| 1007 | 1007 |
| 1008 // Check that the code was patched as expected. | 1008 // Check that the code was patched as expected. |
| 1009 ASSERT(masm_.pc_ == address_ + size_); | 1009 ASSERT(masm_.pc_ == address_ + size_); |
| 1010 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1010 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 | 1013 |
| 1014 } } // namespace v8::internal | 1014 } } // namespace v8::internal |
| OLD | NEW |