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

Side by Side Diff: src/jump-target.cc

Issue 549079: Support for MIPS in architecture independent files.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 11 months 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 209
210 void JumpTarget::Jump(Result* arg) { 210 void JumpTarget::Jump(Result* arg) {
211 ASSERT(cgen()->has_valid_frame()); 211 ASSERT(cgen()->has_valid_frame());
212 212
213 cgen()->frame()->Push(arg); 213 cgen()->frame()->Push(arg);
214 DoJump(); 214 DoJump();
215 } 215 }
216 216
217 217
218 #ifndef V8_TARGET_ARCH_MIPS
218 void JumpTarget::Branch(Condition cc, Hint hint) { 219 void JumpTarget::Branch(Condition cc, Hint hint) {
219 DoBranch(cc, hint); 220 DoBranch(cc, hint);
220 } 221 }
222 #else
223 void JumpTarget::Branch(Condition cc, Hint hint, Register src1, const Operand& s rc2) {
224 DoBranch(cc, hint, src1, src2);
225 }
226 #endif
221 227
222 228
223 #ifdef DEBUG 229 #ifdef DEBUG
224 #define DECLARE_ARGCHECK_VARS(name) \ 230 #define DECLARE_ARGCHECK_VARS(name) \
225 Result::Type name##_type = name->type(); \ 231 Result::Type name##_type = name->type(); \
226 Register name##_reg = name->is_register() ? name->reg() : no_reg 232 Register name##_reg = name->is_register() ? name->reg() : no_reg
227 233
228 #define ASSERT_ARGCHECK(name) \ 234 #define ASSERT_ARGCHECK(name) \
229 ASSERT(name->type() == name##_type); \ 235 ASSERT(name->type() == name##_type); \
230 ASSERT(!name->is_register() || name->reg().is(name##_reg)) 236 ASSERT(!name->is_register() || name->reg().is(name##_reg))
231 237
232 #else 238 #else
233 #define DECLARE_ARGCHECK_VARS(name) do {} while (false) 239 #define DECLARE_ARGCHECK_VARS(name) do {} while (false)
234 240
235 #define ASSERT_ARGCHECK(name) do {} while (false) 241 #define ASSERT_ARGCHECK(name) do {} while (false)
236 #endif 242 #endif
237 243
244 #ifndef V8_TARGET_ARCH_MIPS
238 void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) { 245 void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) {
239 ASSERT(cgen()->has_valid_frame()); 246 ASSERT(cgen()->has_valid_frame());
240 247
241 // We want to check that non-frame registers at the call site stay in 248 // We want to check that non-frame registers at the call site stay in
242 // the same registers on the fall-through branch. 249 // the same registers on the fall-through branch.
243 DECLARE_ARGCHECK_VARS(arg); 250 DECLARE_ARGCHECK_VARS(arg);
244 251
245 cgen()->frame()->Push(arg); 252 cgen()->frame()->Push(arg);
246 DoBranch(cc, hint); 253 DoBranch(cc, hint);
247 *arg = cgen()->frame()->Pop(); 254 *arg = cgen()->frame()->Pop();
248 255
249 ASSERT_ARGCHECK(arg); 256 ASSERT_ARGCHECK(arg);
250 } 257 }
258 #else
259 void JumpTarget::Branch(Condition cc, Result* arg, Hint hint, Register src1, con st Operand& src2) {
260 ASSERT(cgen()->has_valid_frame());
261
262 // We want to check that non-frame registers at the call site stay in
263 // the same registers on the fall-through branch.
264 DECLARE_ARGCHECK_VARS(arg);
265
266 cgen()->frame()->Push(arg);
267 DoBranch(cc, hint, src1, src2);
268 *arg = cgen()->frame()->Pop();
269
270 ASSERT_ARGCHECK(arg);
271 }
272 #endif
251 273
252 274
275 #ifndef V8_TARGET_ARCH_MIPS
253 void BreakTarget::Branch(Condition cc, Result* arg, Hint hint) { 276 void BreakTarget::Branch(Condition cc, Result* arg, Hint hint) {
254 ASSERT(cgen()->has_valid_frame()); 277 ASSERT(cgen()->has_valid_frame());
255 278
256 int count = cgen()->frame()->height() - expected_height_; 279 int count = cgen()->frame()->height() - expected_height_;
257 if (count > 0) { 280 if (count > 0) {
258 // We negate and branch here rather than using DoBranch's negate 281 // We negate and branch here rather than using DoBranch's negate
259 // and branch. This gives us a hook to remove statement state 282 // and branch. This gives us a hook to remove statement state
260 // from the frame. 283 // from the frame.
261 JumpTarget fall_through; 284 JumpTarget fall_through;
262 // Branch to fall through will not negate, because it is a 285 // Branch to fall through will not negate, because it is a
263 // forward-only target. 286 // forward-only target.
264 fall_through.Branch(NegateCondition(cc), NegateHint(hint)); 287 fall_through.Branch(NegateCondition(cc), NegateHint(hint));
265 Jump(arg); // May emit merge code here. 288 Jump(arg); // May emit merge code here.
266 fall_through.Bind(); 289 fall_through.Bind();
267 } else { 290 } else {
268 DECLARE_ARGCHECK_VARS(arg); 291 DECLARE_ARGCHECK_VARS(arg);
269 cgen()->frame()->Push(arg); 292 cgen()->frame()->Push(arg);
270 DoBranch(cc, hint); 293 DoBranch(cc, hint);
271 *arg = cgen()->frame()->Pop(); 294 *arg = cgen()->frame()->Pop();
272 ASSERT_ARGCHECK(arg); 295 ASSERT_ARGCHECK(arg);
273 } 296 }
274 } 297 }
298 #else
299 void BreakTarget::Branch(Condition cc, Result* arg, Hint hint,
300 Register src1, const Operand& src2) {
301 ASSERT(cgen()->has_valid_frame());
302
303 int count = cgen()->frame()->height() - expected_height_;
304 if (count > 0) {
305 // We negate and branch here rather than using DoBranch's negate
306 // and branch. This gives us a hook to remove statement state
307 // from the frame.
308 JumpTarget fall_through;
309 // Branch to fall through will not negate, because it is a
310 // forward-only target.
311 fall_through.Branch(NegateCondition(cc), NegateHint(hint), src1, src2);
312 Jump(arg); // May emit merge code here.
313 fall_through.Bind();
314 } else {
315 DECLARE_ARGCHECK_VARS(arg);
316 cgen()->frame()->Push(arg);
317 DoBranch(cc, hint, src1, src2);
318 *arg = cgen()->frame()->Pop();
319 ASSERT_ARGCHECK(arg);
320 }
321 }
322 #endif
275 323
276 #undef DECLARE_ARGCHECK_VARS 324 #undef DECLARE_ARGCHECK_VARS
277 #undef ASSERT_ARGCHECK 325 #undef ASSERT_ARGCHECK
278 326
279 327
280 void JumpTarget::Bind() { 328 void JumpTarget::Bind() {
281 DoBind(); 329 DoBind();
282 } 330 }
283 331
284 332
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 destination->reaching_frames_.Rewind(0); 364 destination->reaching_frames_.Rewind(0);
317 destination->reaching_frames_.AddAll(reaching_frames_); 365 destination->reaching_frames_.AddAll(reaching_frames_);
318 destination->merge_labels_.Rewind(0); 366 destination->merge_labels_.Rewind(0);
319 destination->merge_labels_.AddAll(merge_labels_); 367 destination->merge_labels_.AddAll(merge_labels_);
320 destination->entry_frame_ = entry_frame_; 368 destination->entry_frame_ = entry_frame_;
321 destination->entry_label_ = entry_label_; 369 destination->entry_label_ = entry_label_;
322 destination->expected_height_ = expected_height_; 370 destination->expected_height_ = expected_height_;
323 } 371 }
324 372
325 373
374 #ifndef V8_TARGET_ARCH_MIPS
326 void BreakTarget::Branch(Condition cc, Hint hint) { 375 void BreakTarget::Branch(Condition cc, Hint hint) {
327 ASSERT(cgen()->has_valid_frame()); 376 ASSERT(cgen()->has_valid_frame());
328 377
329 int count = cgen()->frame()->height() - expected_height_; 378 int count = cgen()->frame()->height() - expected_height_;
330 if (count > 0) { 379 if (count > 0) {
331 // We negate and branch here rather than using DoBranch's negate 380 // We negate and branch here rather than using DoBranch's negate
332 // and branch. This gives us a hook to remove statement state 381 // and branch. This gives us a hook to remove statement state
333 // from the frame. 382 // from the frame.
334 JumpTarget fall_through; 383 JumpTarget fall_through;
335 // Branch to fall through will not negate, because it is a 384 // Branch to fall through will not negate, because it is a
336 // forward-only target. 385 // forward-only target.
337 fall_through.Branch(NegateCondition(cc), NegateHint(hint)); 386 fall_through.Branch(NegateCondition(cc), NegateHint(hint));
338 Jump(); // May emit merge code here. 387 Jump(); // May emit merge code here.
339 fall_through.Bind(); 388 fall_through.Bind();
340 } else { 389 } else {
341 DoBranch(cc, hint); 390 DoBranch(cc, hint);
342 } 391 }
343 } 392 }
393 #else
394 void BreakTarget::Branch(Condition cc, Hint hint, Register src1, const Operand& src2) {
395 ASSERT(cgen()->has_valid_frame());
396
397 int count = cgen()->frame()->height() - expected_height_;
398 if (count > 0) {
399 // We negate and branch here rather than using DoBranch's negate
400 // and branch. This gives us a hook to remove statement state
401 // from the frame.
402 JumpTarget fall_through;
403 // Branch to fall through will not negate, because it is a
404 // forward-only target.
405 fall_through.Branch(NegateCondition(cc), NegateHint(hint), src1, src2);
406 Jump(); // May emit merge code here.
407 fall_through.Bind();
408 } else {
409 DoBranch(cc, hint, src1, src2);
410 }
411 }
412 #endif
344 413
345 414
346 // ------------------------------------------------------------------------- 415 // -------------------------------------------------------------------------
347 // ShadowTarget implementation. 416 // ShadowTarget implementation.
348 417
349 ShadowTarget::ShadowTarget(BreakTarget* shadowed) { 418 ShadowTarget::ShadowTarget(BreakTarget* shadowed) {
350 ASSERT(shadowed != NULL); 419 ASSERT(shadowed != NULL);
351 other_target_ = shadowed; 420 other_target_ = shadowed;
352 421
353 #ifdef DEBUG 422 #ifdef DEBUG
(...skipping 20 matching lines...) Expand all
374 temp.CopyTo(this); 443 temp.CopyTo(this);
375 temp.Unuse(); 444 temp.Unuse();
376 445
377 #ifdef DEBUG 446 #ifdef DEBUG
378 is_shadowing_ = false; 447 is_shadowing_ = false;
379 #endif 448 #endif
380 } 449 }
381 450
382 451
383 } } // namespace v8::internal 452 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698