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 3438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3449 movq(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); | 3449 movq(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); |
3450 | 3450 |
3451 // Check the context is a native context. | 3451 // Check the context is a native context. |
3452 if (emit_debug_code()) { | 3452 if (emit_debug_code()) { |
3453 Cmp(FieldOperand(scratch, HeapObject::kMapOffset), | 3453 Cmp(FieldOperand(scratch, HeapObject::kMapOffset), |
3454 isolate()->factory()->native_context_map()); | 3454 isolate()->factory()->native_context_map()); |
3455 Check(equal, "JSGlobalObject::native_context should be a native context."); | 3455 Check(equal, "JSGlobalObject::native_context should be a native context."); |
3456 } | 3456 } |
3457 | 3457 |
3458 // Check if both contexts are the same. | 3458 // Check if both contexts are the same. |
3459 cmpq(scratch, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 3459 cmpq(scratch, FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); |
3460 j(equal, &same_contexts); | 3460 j(equal, &same_contexts); |
3461 | 3461 |
3462 // Compare security tokens. | 3462 // Compare security tokens. |
3463 // Check that the security token in the calling global object is | 3463 // Check that the security token in the calling global object is |
3464 // compatible with the security token in the receiving global | 3464 // compatible with the security token in the receiving global |
3465 // object. | 3465 // object. |
3466 | 3466 |
3467 // Check the context is a native context. | 3467 // Check the context is a native context. |
3468 if (emit_debug_code()) { | 3468 if (emit_debug_code()) { |
3469 // Preserve original value of holder_reg. | 3469 // Preserve original value of holder_reg. |
3470 push(holder_reg); | 3470 push(holder_reg); |
3471 movq(holder_reg, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 3471 movq(holder_reg, |
| 3472 FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); |
3472 CompareRoot(holder_reg, Heap::kNullValueRootIndex); | 3473 CompareRoot(holder_reg, Heap::kNullValueRootIndex); |
3473 Check(not_equal, "JSGlobalProxy::context() should not be null."); | 3474 Check(not_equal, "JSGlobalProxy::context() should not be null."); |
3474 | 3475 |
3475 // Read the first word and compare to native_context_map(), | 3476 // Read the first word and compare to native_context_map(), |
3476 movq(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset)); | 3477 movq(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset)); |
3477 CompareRoot(holder_reg, Heap::kNativeContextMapRootIndex); | 3478 CompareRoot(holder_reg, Heap::kNativeContextMapRootIndex); |
3478 Check(equal, "JSGlobalObject::native_context should be a native context."); | 3479 Check(equal, "JSGlobalObject::native_context should be a native context."); |
3479 pop(holder_reg); | 3480 pop(holder_reg); |
3480 } | 3481 } |
3481 | 3482 |
3482 movq(kScratchRegister, | 3483 movq(kScratchRegister, |
3483 FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 3484 FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); |
3484 int token_offset = | 3485 int token_offset = |
3485 Context::kHeaderSize + Context::SECURITY_TOKEN_INDEX * kPointerSize; | 3486 Context::kHeaderSize + Context::SECURITY_TOKEN_INDEX * kPointerSize; |
3486 movq(scratch, FieldOperand(scratch, token_offset)); | 3487 movq(scratch, FieldOperand(scratch, token_offset)); |
3487 cmpq(scratch, FieldOperand(kScratchRegister, token_offset)); | 3488 cmpq(scratch, FieldOperand(kScratchRegister, token_offset)); |
3488 j(not_equal, miss); | 3489 j(not_equal, miss); |
3489 | 3490 |
3490 bind(&same_contexts); | 3491 bind(&same_contexts); |
3491 } | 3492 } |
3492 | 3493 |
3493 | 3494 |
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4504 bind(&check_prototype); | 4505 bind(&check_prototype); |
4505 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4506 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
4506 cmpq(rcx, null_value); | 4507 cmpq(rcx, null_value); |
4507 j(not_equal, &next); | 4508 j(not_equal, &next); |
4508 } | 4509 } |
4509 | 4510 |
4510 | 4511 |
4511 } } // namespace v8::internal | 4512 } } // namespace v8::internal |
4512 | 4513 |
4513 #endif // V8_TARGET_ARCH_X64 | 4514 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |