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 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 #endif | 1397 #endif |
1398 | 1398 |
1399 // Load the native context of the current context. | 1399 // Load the native context of the current context. |
1400 int offset = | 1400 int offset = |
1401 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | 1401 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
1402 ldr(scratch, FieldMemOperand(scratch, offset)); | 1402 ldr(scratch, FieldMemOperand(scratch, offset)); |
1403 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | 1403 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); |
1404 | 1404 |
1405 // Check the context is a native context. | 1405 // Check the context is a native context. |
1406 if (emit_debug_code()) { | 1406 if (emit_debug_code()) { |
1407 // TODO(119): avoid push(holder_reg)/pop(holder_reg) | |
1408 // Cannot use ip as a temporary in this verification code. Due to the fact | 1407 // Cannot use ip as a temporary in this verification code. Due to the fact |
1409 // that ip is clobbered as part of cmp with an object Operand. | 1408 // that ip is clobbered as part of cmp with an object Operand. |
1410 push(holder_reg); // Temporarily save holder on the stack. | 1409 push(holder_reg); // Temporarily save holder on the stack. |
1411 // Read the first word and compare to the native_context_map. | 1410 // Read the first word and compare to the native_context_map. |
1412 ldr(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); | 1411 ldr(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
1413 LoadRoot(ip, Heap::kNativeContextMapRootIndex); | 1412 LoadRoot(ip, Heap::kNativeContextMapRootIndex); |
1414 cmp(holder_reg, ip); | 1413 cmp(holder_reg, ip); |
1415 Check(eq, "JSGlobalObject::native_context should be a native context."); | 1414 Check(eq, "JSGlobalObject::native_context should be a native context."); |
1416 pop(holder_reg); // Restore holder. | 1415 pop(holder_reg); // Restore holder. |
1417 } | 1416 } |
1418 | 1417 |
1419 // Check if both contexts are the same. | 1418 // Check if both contexts are the same. |
1420 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | 1419 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); |
1421 cmp(scratch, Operand(ip)); | 1420 cmp(scratch, Operand(ip)); |
1422 b(eq, &same_contexts); | 1421 b(eq, &same_contexts); |
1423 | 1422 |
1424 // Check the context is a native context. | 1423 // Check the context is a native context. |
1425 if (emit_debug_code()) { | 1424 if (emit_debug_code()) { |
1426 // TODO(119): avoid push(holder_reg)/pop(holder_reg) | |
1427 // Cannot use ip as a temporary in this verification code. Due to the fact | 1425 // Cannot use ip as a temporary in this verification code. Due to the fact |
1428 // that ip is clobbered as part of cmp with an object Operand. | 1426 // that ip is clobbered as part of cmp with an object Operand. |
1429 push(holder_reg); // Temporarily save holder on the stack. | 1427 push(holder_reg); // Temporarily save holder on the stack. |
1430 mov(holder_reg, ip); // Move ip to its holding place. | 1428 mov(holder_reg, ip); // Move ip to its holding place. |
1431 LoadRoot(ip, Heap::kNullValueRootIndex); | 1429 LoadRoot(ip, Heap::kNullValueRootIndex); |
1432 cmp(holder_reg, ip); | 1430 cmp(holder_reg, ip); |
1433 Check(ne, "JSGlobalProxy::context() should not be null."); | 1431 Check(ne, "JSGlobalProxy::context() should not be null."); |
1434 | 1432 |
1435 ldr(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); | 1433 ldr(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); |
1436 LoadRoot(ip, Heap::kNativeContextMapRootIndex); | 1434 LoadRoot(ip, Heap::kNativeContextMapRootIndex); |
(...skipping 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3949 void CodePatcher::EmitCondition(Condition cond) { | 3947 void CodePatcher::EmitCondition(Condition cond) { |
3950 Instr instr = Assembler::instr_at(masm_.pc_); | 3948 Instr instr = Assembler::instr_at(masm_.pc_); |
3951 instr = (instr & ~kCondMask) | cond; | 3949 instr = (instr & ~kCondMask) | cond; |
3952 masm_.emit(instr); | 3950 masm_.emit(instr); |
3953 } | 3951 } |
3954 | 3952 |
3955 | 3953 |
3956 } } // namespace v8::internal | 3954 } } // namespace v8::internal |
3957 | 3955 |
3958 #endif // V8_TARGET_ARCH_ARM | 3956 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |