OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 ParameterCount expected(0); | 1042 ParameterCount expected(0); |
1043 InvokeCode(Handle<Code>(code), expected, expected, | 1043 InvokeCode(Handle<Code>(code), expected, expected, |
1044 RelocInfo::CODE_TARGET, flag); | 1044 RelocInfo::CODE_TARGET, flag); |
1045 | 1045 |
1046 const char* name = Builtins::GetName(id); | 1046 const char* name = Builtins::GetName(id); |
1047 int argc = Builtins::GetArgumentsCount(id); | 1047 int argc = Builtins::GetArgumentsCount(id); |
1048 | 1048 |
1049 if (!resolved) { | 1049 if (!resolved) { |
1050 uint32_t flags = | 1050 uint32_t flags = |
1051 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) | | 1051 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) | |
1052 Bootstrapper::FixupFlagsIsPCRelative::encode(true) | | |
1053 Bootstrapper::FixupFlagsUseCodeObject::encode(false); | 1052 Bootstrapper::FixupFlagsUseCodeObject::encode(false); |
1054 Unresolved entry = { pc_offset() - sizeof(int32_t), flags, name }; | 1053 Unresolved entry = { pc_offset() - sizeof(int32_t), flags, name }; |
1055 unresolved_.Add(entry); | 1054 unresolved_.Add(entry); |
1056 } | 1055 } |
1057 } | 1056 } |
1058 | 1057 |
1059 | 1058 |
1060 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { | 1059 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { |
1061 bool resolved; | 1060 bool resolved; |
1062 Handle<Code> code = ResolveBuiltin(id, &resolved); | 1061 Handle<Code> code = ResolveBuiltin(id, &resolved); |
1063 | 1062 |
1064 const char* name = Builtins::GetName(id); | 1063 const char* name = Builtins::GetName(id); |
1065 int argc = Builtins::GetArgumentsCount(id); | 1064 int argc = Builtins::GetArgumentsCount(id); |
1066 | 1065 |
1067 mov(Operand(target), Immediate(code)); | 1066 mov(Operand(target), Immediate(code)); |
1068 if (!resolved) { | 1067 if (!resolved) { |
1069 uint32_t flags = | 1068 uint32_t flags = |
1070 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) | | 1069 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) | |
1071 Bootstrapper::FixupFlagsIsPCRelative::encode(false) | | |
1072 Bootstrapper::FixupFlagsUseCodeObject::encode(true); | 1070 Bootstrapper::FixupFlagsUseCodeObject::encode(true); |
1073 Unresolved entry = { pc_offset() - sizeof(int32_t), flags, name }; | 1071 Unresolved entry = { pc_offset() - sizeof(int32_t), flags, name }; |
1074 unresolved_.Add(entry); | 1072 unresolved_.Add(entry); |
1075 } | 1073 } |
1076 add(Operand(target), Immediate(Code::kHeaderSize - kHeapObjectTag)); | 1074 add(Operand(target), Immediate(Code::kHeaderSize - kHeapObjectTag)); |
1077 } | 1075 } |
1078 | 1076 |
1079 | 1077 |
1080 Handle<Code> MacroAssembler::ResolveBuiltin(Builtins::JavaScript id, | 1078 Handle<Code> MacroAssembler::ResolveBuiltin(Builtins::JavaScript id, |
1081 bool* resolved) { | 1079 bool* resolved) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 // Indicate that code has changed. | 1181 // Indicate that code has changed. |
1184 CPU::FlushICache(address_, size_); | 1182 CPU::FlushICache(address_, size_); |
1185 | 1183 |
1186 // Check that the code was patched as expected. | 1184 // Check that the code was patched as expected. |
1187 ASSERT(masm_.pc_ == address_ + size_); | 1185 ASSERT(masm_.pc_ == address_ + size_); |
1188 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1186 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1189 } | 1187 } |
1190 | 1188 |
1191 | 1189 |
1192 } } // namespace v8::internal | 1190 } } // namespace v8::internal |
OLD | NEW |