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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 312 |
313 void MacroAssembler::FCmp() { | 313 void MacroAssembler::FCmp() { |
314 fcompp(); | 314 fcompp(); |
315 push(eax); | 315 push(eax); |
316 fnstsw_ax(); | 316 fnstsw_ax(); |
317 sahf(); | 317 sahf(); |
318 pop(eax); | 318 pop(eax); |
319 } | 319 } |
320 | 320 |
321 | 321 |
322 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 322 void MacroAssembler::EnterInternalFrame() { |
323 ASSERT(type != StackFrame::JAVA_SCRIPT); | 323 int type = StackFrame::INTERNAL; |
| 324 |
324 push(ebp); | 325 push(ebp); |
325 mov(ebp, Operand(esp)); | 326 mov(ebp, Operand(esp)); |
326 push(esi); | 327 push(esi); |
327 push(Immediate(Smi::FromInt(type))); | 328 push(Immediate(Smi::FromInt(type))); |
328 if (type == StackFrame::INTERNAL) { | 329 push(Immediate(0)); // Push an empty code cache slot. |
329 push(Immediate(0)); | |
330 } | |
331 } | 330 } |
332 | 331 |
333 | 332 |
334 void MacroAssembler::ExitFrame(StackFrame::Type type) { | 333 void MacroAssembler::ExitInternalFrame() { |
335 ASSERT(type != StackFrame::JAVA_SCRIPT); | |
336 if (FLAG_debug_code) { | 334 if (FLAG_debug_code) { |
| 335 StackFrame::Type type = StackFrame::INTERNAL; |
337 cmp(Operand(ebp, StandardFrameConstants::kMarkerOffset), | 336 cmp(Operand(ebp, StandardFrameConstants::kMarkerOffset), |
338 Immediate(Smi::FromInt(type))); | 337 Immediate(Smi::FromInt(type))); |
339 Check(equal, "stack frame types must match"); | 338 Check(equal, "stack frame types must match"); |
340 } | 339 } |
341 leave(); | 340 leave(); |
342 } | 341 } |
343 | 342 |
344 | 343 |
345 void MacroAssembler::PushTryHandler(CodeLocation try_location, | 344 void MacroAssembler::PushTryHandler(CodeLocation try_location, |
346 HandlerType type) { | 345 HandlerType type) { |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 // reading it from the builtins object. NOTE: We should be able to | 719 // reading it from the builtins object. NOTE: We should be able to |
721 // reduce this to two instructions by putting the function table in | 720 // reduce this to two instructions by putting the function table in |
722 // the global object instead of the "builtins" object and by using a | 721 // the global object instead of the "builtins" object and by using a |
723 // real register for the function. | 722 // real register for the function. |
724 mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 723 mov(edx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
725 mov(edx, FieldOperand(edx, GlobalObject::kBuiltinsOffset)); | 724 mov(edx, FieldOperand(edx, GlobalObject::kBuiltinsOffset)); |
726 int builtins_offset = | 725 int builtins_offset = |
727 JSBuiltinsObject::kJSBuiltinsOffset + (id * kPointerSize); | 726 JSBuiltinsObject::kJSBuiltinsOffset + (id * kPointerSize); |
728 mov(edi, FieldOperand(edx, builtins_offset)); | 727 mov(edi, FieldOperand(edx, builtins_offset)); |
729 | 728 |
730 Code* code = Builtins::builtin(Builtins::Illegal); | |
731 *resolved = false; | |
732 | 729 |
733 if (Top::security_context() != NULL) { | 730 return Builtins::GetCode(id, resolved); |
734 Object* object = Top::security_context_builtins()->javascript_builtin(id); | |
735 if (object->IsJSFunction()) { | |
736 Handle<JSFunction> function(JSFunction::cast(object)); | |
737 // Make sure the number of parameters match the formal parameter count. | |
738 ASSERT(function->shared()->formal_parameter_count() == | |
739 Builtins::GetArgumentsCount(id)); | |
740 if (function->is_compiled() || CompileLazy(function, CLEAR_EXCEPTION)) { | |
741 code = function->code(); | |
742 *resolved = true; | |
743 } | |
744 } | |
745 } | |
746 | |
747 return Handle<Code>(code); | |
748 } | 731 } |
749 | 732 |
750 | 733 |
751 void MacroAssembler::Ret() { | 734 void MacroAssembler::Ret() { |
752 ret(0); | 735 ret(0); |
753 } | 736 } |
754 | 737 |
755 | 738 |
756 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { | 739 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { |
757 if (FLAG_native_code_counters && counter->Enabled()) { | 740 if (FLAG_native_code_counters && counter->Enabled()) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 // Indicate that code has changed. | 819 // Indicate that code has changed. |
837 CPU::FlushICache(address_, size_); | 820 CPU::FlushICache(address_, size_); |
838 | 821 |
839 // Check that the code was patched as expected. | 822 // Check that the code was patched as expected. |
840 ASSERT(masm_.pc_ == address_ + size_); | 823 ASSERT(masm_.pc_ == address_ + size_); |
841 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 824 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
842 } | 825 } |
843 | 826 |
844 | 827 |
845 } } // namespace v8::internal | 828 } } // namespace v8::internal |
OLD | NEW |