Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 504071: Disallow garbage collection at another site in the LoadCallback ICs.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 } 1065 }
1066 mov(eax, Immediate(Factory::undefined_value())); 1066 mov(eax, Immediate(Factory::undefined_value()));
1067 } 1067 }
1068 1068
1069 1069
1070 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { 1070 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) {
1071 CallRuntime(Runtime::FunctionForId(id), num_arguments); 1071 CallRuntime(Runtime::FunctionForId(id), num_arguments);
1072 } 1072 }
1073 1073
1074 1074
1075 Object* MacroAssembler::TryCallRuntime(Runtime::FunctionId id,
1076 int num_arguments) {
1077 return TryCallRuntime(Runtime::FunctionForId(id), num_arguments);
1078 }
1079
1080
1075 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { 1081 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) {
1076 // If the expected number of arguments of the runtime function is 1082 // If the expected number of arguments of the runtime function is
1077 // constant, we check that the actual number of arguments match the 1083 // constant, we check that the actual number of arguments match the
1078 // expectation. 1084 // expectation.
1079 if (f->nargs >= 0 && f->nargs != num_arguments) { 1085 if (f->nargs >= 0 && f->nargs != num_arguments) {
1080 IllegalOperation(num_arguments); 1086 IllegalOperation(num_arguments);
1081 return; 1087 return;
1082 } 1088 }
1083 1089
1084 Runtime::FunctionId function_id = 1090 Runtime::FunctionId function_id =
1085 static_cast<Runtime::FunctionId>(f->stub_id); 1091 static_cast<Runtime::FunctionId>(f->stub_id);
1086 RuntimeStub stub(function_id, num_arguments); 1092 RuntimeStub stub(function_id, num_arguments);
1087 CallStub(&stub); 1093 CallStub(&stub);
1088 } 1094 }
1089 1095
1090 1096
1097 Object* MacroAssembler::TryCallRuntime(Runtime::Function* f,
1098 int num_arguments) {
1099 if (f->nargs >= 0 && f->nargs != num_arguments) {
1100 IllegalOperation(num_arguments);
1101 // Since we did not call the stub, there was no allocation failure.
1102 // Return some non-failure object.
1103 return Heap::undefined_value();
1104 }
1105
1106 Runtime::FunctionId function_id =
1107 static_cast<Runtime::FunctionId>(f->stub_id);
1108 RuntimeStub stub(function_id, num_arguments);
1109 return TryCallStub(&stub);
1110 }
1111
1112
1091 void MacroAssembler::TailCallRuntime(const ExternalReference& ext, 1113 void MacroAssembler::TailCallRuntime(const ExternalReference& ext,
1092 int num_arguments, 1114 int num_arguments,
1093 int result_size) { 1115 int result_size) {
1094 // TODO(1236192): Most runtime routines don't need the number of 1116 // TODO(1236192): Most runtime routines don't need the number of
1095 // arguments passed in because it is constant. At some point we 1117 // arguments passed in because it is constant. At some point we
1096 // should remove this need and make the runtime routine entry code 1118 // should remove this need and make the runtime routine entry code
1097 // smarter. 1119 // smarter.
1098 Set(eax, Immediate(num_arguments)); 1120 Set(eax, Immediate(num_arguments));
1099 JumpToRuntime(ext); 1121 JumpToRuntime(ext);
1100 } 1122 }
(...skipping 12 matching lines...) Expand all
1113 // hence automatically smi tagged. 1135 // hence automatically smi tagged.
1114 ExternalReference next_address = 1136 ExternalReference next_address =
1115 ExternalReference::handle_scope_next_address(); 1137 ExternalReference::handle_scope_next_address();
1116 push(Operand::StaticVariable(next_address)); 1138 push(Operand::StaticVariable(next_address));
1117 ExternalReference limit_address = 1139 ExternalReference limit_address =
1118 ExternalReference::handle_scope_limit_address(); 1140 ExternalReference::handle_scope_limit_address();
1119 push(Operand::StaticVariable(limit_address)); 1141 push(Operand::StaticVariable(limit_address));
1120 } 1142 }
1121 1143
1122 1144
1123 void MacroAssembler::PopHandleScope(Register saved, Register scratch) { 1145 Object* MacroAssembler::PopHandleScopeHelper(Register saved,
1146 Register scratch,
1147 bool gc_allowed) {
1148 Object* result = NULL;
1124 ExternalReference extensions_address = 1149 ExternalReference extensions_address =
1125 ExternalReference::handle_scope_extensions_address(); 1150 ExternalReference::handle_scope_extensions_address();
1126 Label write_back; 1151 Label write_back;
1127 mov(scratch, Operand::StaticVariable(extensions_address)); 1152 mov(scratch, Operand::StaticVariable(extensions_address));
1128 cmp(Operand(scratch), Immediate(0)); 1153 cmp(Operand(scratch), Immediate(0));
1129 j(equal, &write_back); 1154 j(equal, &write_back);
1130 // Calling a runtime function messes with registers so we save and 1155 // Calling a runtime function messes with registers so we save and
1131 // restore any one we're asked not to change 1156 // restore any one we're asked not to change
1132 if (saved.is_valid()) push(saved); 1157 if (saved.is_valid()) push(saved);
1133 CallRuntime(Runtime::kDeleteHandleScopeExtensions, 0); 1158 if (gc_allowed) {
1159 CallRuntime(Runtime::kDeleteHandleScopeExtensions, 0);
1160 } else {
1161 result = TryCallRuntime(Runtime::kDeleteHandleScopeExtensions, 0);
1162 if (result->IsFailure()) return result;
1163 }
1134 if (saved.is_valid()) pop(saved); 1164 if (saved.is_valid()) pop(saved);
1135 1165
1136 bind(&write_back); 1166 bind(&write_back);
1137 ExternalReference limit_address = 1167 ExternalReference limit_address =
1138 ExternalReference::handle_scope_limit_address(); 1168 ExternalReference::handle_scope_limit_address();
1139 pop(Operand::StaticVariable(limit_address)); 1169 pop(Operand::StaticVariable(limit_address));
1140 ExternalReference next_address = 1170 ExternalReference next_address =
1141 ExternalReference::handle_scope_next_address(); 1171 ExternalReference::handle_scope_next_address();
1142 pop(Operand::StaticVariable(next_address)); 1172 pop(Operand::StaticVariable(next_address));
1143 pop(scratch); 1173 pop(scratch);
1144 shr(scratch, kSmiTagSize); 1174 shr(scratch, kSmiTagSize);
1145 mov(Operand::StaticVariable(extensions_address), scratch); 1175 mov(Operand::StaticVariable(extensions_address), scratch);
1176
1177 return result;
1178 }
1179
1180
1181 void MacroAssembler::PopHandleScope(Register saved, Register scratch) {
1182 PopHandleScopeHelper(saved, scratch, true);
1183 }
1184
1185
1186 Object* MacroAssembler::TryPopHandleScope(Register saved, Register scratch) {
1187 return PopHandleScopeHelper(saved, scratch, false);
1146 } 1188 }
1147 1189
1148 1190
1149 void MacroAssembler::JumpToRuntime(const ExternalReference& ext) { 1191 void MacroAssembler::JumpToRuntime(const ExternalReference& ext) {
1150 // Set the entry point and jump to the C entry runtime stub. 1192 // Set the entry point and jump to the C entry runtime stub.
1151 mov(ebx, Immediate(ext)); 1193 mov(ebx, Immediate(ext));
1152 CEntryStub ces(1); 1194 CEntryStub ces(1);
1153 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); 1195 jmp(ces.GetCode(), RelocInfo::CODE_TARGET);
1154 } 1196 }
1155 1197
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 // Indicate that code has changed. 1498 // Indicate that code has changed.
1457 CPU::FlushICache(address_, size_); 1499 CPU::FlushICache(address_, size_);
1458 1500
1459 // Check that the code was patched as expected. 1501 // Check that the code was patched as expected.
1460 ASSERT(masm_.pc_ == address_ + size_); 1502 ASSERT(masm_.pc_ == address_ + size_);
1461 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1503 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1462 } 1504 }
1463 1505
1464 1506
1465 } } // namespace v8::internal 1507 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698