OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 #endif | 362 #endif |
363 | 363 |
364 // Load the native context of the current context. | 364 // Load the native context of the current context. |
365 int offset = | 365 int offset = |
366 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | 366 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
367 lw(scratch, FieldMemOperand(scratch, offset)); | 367 lw(scratch, FieldMemOperand(scratch, offset)); |
368 lw(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | 368 lw(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); |
369 | 369 |
370 // Check the context is a native context. | 370 // Check the context is a native context. |
371 if (emit_debug_code()) { | 371 if (emit_debug_code()) { |
372 // TODO(119): Avoid push(holder_reg)/pop(holder_reg). | |
373 push(holder_reg); // Temporarily save holder on the stack. | 372 push(holder_reg); // Temporarily save holder on the stack. |
374 // Read the first word and compare to the native_context_map. | 373 // Read the first word and compare to the native_context_map. |
375 lw(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); | 374 lw(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
376 LoadRoot(at, Heap::kNativeContextMapRootIndex); | 375 LoadRoot(at, Heap::kNativeContextMapRootIndex); |
377 Check(eq, "JSGlobalObject::native_context should be a native context.", | 376 Check(eq, "JSGlobalObject::native_context should be a native context.", |
378 holder_reg, Operand(at)); | 377 holder_reg, Operand(at)); |
379 pop(holder_reg); // Restore holder. | 378 pop(holder_reg); // Restore holder. |
380 } | 379 } |
381 | 380 |
382 // Check if both contexts are the same. | 381 // Check if both contexts are the same. |
383 lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | 382 lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); |
384 Branch(&same_contexts, eq, scratch, Operand(at)); | 383 Branch(&same_contexts, eq, scratch, Operand(at)); |
385 | 384 |
386 // Check the context is a native context. | 385 // Check the context is a native context. |
387 if (emit_debug_code()) { | 386 if (emit_debug_code()) { |
388 // TODO(119): Avoid push(holder_reg)/pop(holder_reg). | |
389 push(holder_reg); // Temporarily save holder on the stack. | 387 push(holder_reg); // Temporarily save holder on the stack. |
390 mov(holder_reg, at); // Move at to its holding place. | 388 mov(holder_reg, at); // Move at to its holding place. |
391 LoadRoot(at, Heap::kNullValueRootIndex); | 389 LoadRoot(at, Heap::kNullValueRootIndex); |
392 Check(ne, "JSGlobalProxy::context() should not be null.", | 390 Check(ne, "JSGlobalProxy::context() should not be null.", |
393 holder_reg, Operand(at)); | 391 holder_reg, Operand(at)); |
394 | 392 |
395 lw(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); | 393 lw(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); |
396 LoadRoot(at, Heap::kNativeContextMapRootIndex); | 394 LoadRoot(at, Heap::kNativeContextMapRootIndex); |
397 Check(eq, "JSGlobalObject::native_context should be a native context.", | 395 Check(eq, "JSGlobalObject::native_context should be a native context.", |
398 holder_reg, Operand(at)); | 396 holder_reg, Operand(at)); |
(...skipping 5163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5562 opcode == BGTZL); | 5560 opcode == BGTZL); |
5563 opcode = (cond == eq) ? BEQ : BNE; | 5561 opcode = (cond == eq) ? BEQ : BNE; |
5564 instr = (instr & ~kOpcodeMask) | opcode; | 5562 instr = (instr & ~kOpcodeMask) | opcode; |
5565 masm_.emit(instr); | 5563 masm_.emit(instr); |
5566 } | 5564 } |
5567 | 5565 |
5568 | 5566 |
5569 } } // namespace v8::internal | 5567 } } // namespace v8::internal |
5570 | 5568 |
5571 #endif // V8_TARGET_ARCH_MIPS | 5569 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |