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 3424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3435 ASSERT(!holder_reg.is(scratch)); | 3435 ASSERT(!holder_reg.is(scratch)); |
3436 ASSERT(!scratch.is(kScratchRegister)); | 3436 ASSERT(!scratch.is(kScratchRegister)); |
3437 // Load current lexical context from the stack frame. | 3437 // Load current lexical context from the stack frame. |
3438 movq(scratch, Operand(rbp, StandardFrameConstants::kContextOffset)); | 3438 movq(scratch, Operand(rbp, StandardFrameConstants::kContextOffset)); |
3439 | 3439 |
3440 // When generating debug code, make sure the lexical context is set. | 3440 // When generating debug code, make sure the lexical context is set. |
3441 if (emit_debug_code()) { | 3441 if (emit_debug_code()) { |
3442 cmpq(scratch, Immediate(0)); | 3442 cmpq(scratch, Immediate(0)); |
3443 Check(not_equal, "we should not have an empty lexical context"); | 3443 Check(not_equal, "we should not have an empty lexical context"); |
3444 } | 3444 } |
3445 // Load the global context of the current context. | 3445 // Load the native context of the current context. |
3446 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; | 3446 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
3447 movq(scratch, FieldOperand(scratch, offset)); | 3447 movq(scratch, FieldOperand(scratch, offset)); |
3448 movq(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); | 3448 movq(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); |
3449 | 3449 |
3450 // Check the context is a global context. | 3450 // Check the context is a native context. |
3451 if (emit_debug_code()) { | 3451 if (emit_debug_code()) { |
3452 Cmp(FieldOperand(scratch, HeapObject::kMapOffset), | 3452 Cmp(FieldOperand(scratch, HeapObject::kMapOffset), |
3453 isolate()->factory()->global_context_map()); | 3453 isolate()->factory()->native_context_map()); |
3454 Check(equal, "JSGlobalObject::global_context should be a global context."); | 3454 Check(equal, "JSGlobalObject::native_context should be a native context."); |
3455 } | 3455 } |
3456 | 3456 |
3457 // Check if both contexts are the same. | 3457 // Check if both contexts are the same. |
3458 cmpq(scratch, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 3458 cmpq(scratch, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
3459 j(equal, &same_contexts); | 3459 j(equal, &same_contexts); |
3460 | 3460 |
3461 // Compare security tokens. | 3461 // Compare security tokens. |
3462 // Check that the security token in the calling global object is | 3462 // Check that the security token in the calling global object is |
3463 // compatible with the security token in the receiving global | 3463 // compatible with the security token in the receiving global |
3464 // object. | 3464 // object. |
3465 | 3465 |
3466 // Check the context is a global context. | 3466 // Check the context is a native context. |
3467 if (emit_debug_code()) { | 3467 if (emit_debug_code()) { |
3468 // Preserve original value of holder_reg. | 3468 // Preserve original value of holder_reg. |
3469 push(holder_reg); | 3469 push(holder_reg); |
3470 movq(holder_reg, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 3470 movq(holder_reg, FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
3471 CompareRoot(holder_reg, Heap::kNullValueRootIndex); | 3471 CompareRoot(holder_reg, Heap::kNullValueRootIndex); |
3472 Check(not_equal, "JSGlobalProxy::context() should not be null."); | 3472 Check(not_equal, "JSGlobalProxy::context() should not be null."); |
3473 | 3473 |
3474 // Read the first word and compare to global_context_map(), | 3474 // Read the first word and compare to native_context_map(), |
3475 movq(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset)); | 3475 movq(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset)); |
3476 CompareRoot(holder_reg, Heap::kGlobalContextMapRootIndex); | 3476 CompareRoot(holder_reg, Heap::kNativeContextMapRootIndex); |
3477 Check(equal, "JSGlobalObject::global_context should be a global context."); | 3477 Check(equal, "JSGlobalObject::native_context should be a native context."); |
3478 pop(holder_reg); | 3478 pop(holder_reg); |
3479 } | 3479 } |
3480 | 3480 |
3481 movq(kScratchRegister, | 3481 movq(kScratchRegister, |
3482 FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 3482 FieldOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
3483 int token_offset = | 3483 int token_offset = |
3484 Context::kHeaderSize + Context::SECURITY_TOKEN_INDEX * kPointerSize; | 3484 Context::kHeaderSize + Context::SECURITY_TOKEN_INDEX * kPointerSize; |
3485 movq(scratch, FieldOperand(scratch, token_offset)); | 3485 movq(scratch, FieldOperand(scratch, token_offset)); |
3486 cmpq(scratch, FieldOperand(kScratchRegister, token_offset)); | 3486 cmpq(scratch, FieldOperand(kScratchRegister, token_offset)); |
3487 j(not_equal, miss); | 3487 j(not_equal, miss); |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4093 | 4093 |
4094 | 4094 |
4095 void MacroAssembler::LoadTransitionedArrayMapConditional( | 4095 void MacroAssembler::LoadTransitionedArrayMapConditional( |
4096 ElementsKind expected_kind, | 4096 ElementsKind expected_kind, |
4097 ElementsKind transitioned_kind, | 4097 ElementsKind transitioned_kind, |
4098 Register map_in_out, | 4098 Register map_in_out, |
4099 Register scratch, | 4099 Register scratch, |
4100 Label* no_map_match) { | 4100 Label* no_map_match) { |
4101 // Load the global or builtins object from the current context. | 4101 // Load the global or builtins object from the current context. |
4102 movq(scratch, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 4102 movq(scratch, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
4103 movq(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); | 4103 movq(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset)); |
4104 | 4104 |
4105 // Check that the function's map is the same as the expected cached map. | 4105 // Check that the function's map is the same as the expected cached map. |
4106 movq(scratch, Operand(scratch, | 4106 movq(scratch, Operand(scratch, |
4107 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 4107 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
4108 | 4108 |
4109 int offset = expected_kind * kPointerSize + | 4109 int offset = expected_kind * kPointerSize + |
4110 FixedArrayBase::kHeaderSize; | 4110 FixedArrayBase::kHeaderSize; |
4111 cmpq(map_in_out, FieldOperand(scratch, offset)); | 4111 cmpq(map_in_out, FieldOperand(scratch, offset)); |
4112 j(not_equal, no_map_match); | 4112 j(not_equal, no_map_match); |
4113 | 4113 |
(...skipping 30 matching lines...) Expand all Loading... |
4144 | 4144 |
4145 #ifdef _WIN64 | 4145 #ifdef _WIN64 |
4146 static const int kRegisterPassedArguments = 4; | 4146 static const int kRegisterPassedArguments = 4; |
4147 #else | 4147 #else |
4148 static const int kRegisterPassedArguments = 6; | 4148 static const int kRegisterPassedArguments = 6; |
4149 #endif | 4149 #endif |
4150 | 4150 |
4151 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 4151 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
4152 // Load the global or builtins object from the current context. | 4152 // Load the global or builtins object from the current context. |
4153 movq(function, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 4153 movq(function, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
4154 // Load the global context from the global or builtins object. | 4154 // Load the native context from the global or builtins object. |
4155 movq(function, FieldOperand(function, GlobalObject::kGlobalContextOffset)); | 4155 movq(function, FieldOperand(function, GlobalObject::kNativeContextOffset)); |
4156 // Load the function from the global context. | 4156 // Load the function from the native context. |
4157 movq(function, Operand(function, Context::SlotOffset(index))); | 4157 movq(function, Operand(function, Context::SlotOffset(index))); |
4158 } | 4158 } |
4159 | 4159 |
4160 | 4160 |
4161 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 4161 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
4162 Register map) { | 4162 Register map) { |
4163 // Load the initial map. The global functions all have initial maps. | 4163 // Load the initial map. The global functions all have initial maps. |
4164 movq(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 4164 movq(map, FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
4165 if (emit_debug_code()) { | 4165 if (emit_debug_code()) { |
4166 Label ok, fail; | 4166 Label ok, fail; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4501 bind(&check_prototype); | 4501 bind(&check_prototype); |
4502 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4502 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
4503 cmpq(rcx, null_value); | 4503 cmpq(rcx, null_value); |
4504 j(not_equal, &next); | 4504 j(not_equal, &next); |
4505 } | 4505 } |
4506 | 4506 |
4507 | 4507 |
4508 } } // namespace v8::internal | 4508 } } // namespace v8::internal |
4509 | 4509 |
4510 #endif // V8_TARGET_ARCH_X64 | 4510 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |