| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 ASSERT(!scratch.is(at)); | 354 ASSERT(!scratch.is(at)); |
| 355 | 355 |
| 356 // Load current lexical context from the stack frame. | 356 // Load current lexical context from the stack frame. |
| 357 lw(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 357 lw(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 358 // In debug mode, make sure the lexical context is set. | 358 // In debug mode, make sure the lexical context is set. |
| 359 #ifdef DEBUG | 359 #ifdef DEBUG |
| 360 Check(ne, "we should not have an empty lexical context", | 360 Check(ne, "we should not have an empty lexical context", |
| 361 scratch, Operand(zero_reg)); | 361 scratch, Operand(zero_reg)); |
| 362 #endif | 362 #endif |
| 363 | 363 |
| 364 // Load the global context of the current context. | 364 // Load the native context of the current context. |
| 365 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; | 365 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
| 366 lw(scratch, FieldMemOperand(scratch, offset)); | 366 lw(scratch, FieldMemOperand(scratch, offset)); |
| 367 lw(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); | 367 lw(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); |
| 368 | 368 |
| 369 // Check the context is a global context. | 369 // Check the context is a native context. |
| 370 if (emit_debug_code()) { | 370 if (emit_debug_code()) { |
| 371 // TODO(119): Avoid push(holder_reg)/pop(holder_reg). | 371 // TODO(119): Avoid push(holder_reg)/pop(holder_reg). |
| 372 push(holder_reg); // Temporarily save holder on the stack. | 372 push(holder_reg); // Temporarily save holder on the stack. |
| 373 // Read the first word and compare to the global_context_map. | 373 // Read the first word and compare to the native_context_map. |
| 374 lw(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); | 374 lw(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
| 375 LoadRoot(at, Heap::kGlobalContextMapRootIndex); | 375 LoadRoot(at, Heap::kNativeContextMapRootIndex); |
| 376 Check(eq, "JSGlobalObject::global_context should be a global context.", | 376 Check(eq, "JSGlobalObject::native_context should be a native context.", |
| 377 holder_reg, Operand(at)); | 377 holder_reg, Operand(at)); |
| 378 pop(holder_reg); // Restore holder. | 378 pop(holder_reg); // Restore holder. |
| 379 } | 379 } |
| 380 | 380 |
| 381 // Check if both contexts are the same. | 381 // Check if both contexts are the same. |
| 382 lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 382 lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
| 383 Branch(&same_contexts, eq, scratch, Operand(at)); | 383 Branch(&same_contexts, eq, scratch, Operand(at)); |
| 384 | 384 |
| 385 // Check the context is a global context. | 385 // Check the context is a native context. |
| 386 if (emit_debug_code()) { | 386 if (emit_debug_code()) { |
| 387 // TODO(119): Avoid push(holder_reg)/pop(holder_reg). | 387 // TODO(119): Avoid push(holder_reg)/pop(holder_reg). |
| 388 push(holder_reg); // Temporarily save holder on the stack. | 388 push(holder_reg); // Temporarily save holder on the stack. |
| 389 mov(holder_reg, at); // Move at to its holding place. | 389 mov(holder_reg, at); // Move at to its holding place. |
| 390 LoadRoot(at, Heap::kNullValueRootIndex); | 390 LoadRoot(at, Heap::kNullValueRootIndex); |
| 391 Check(ne, "JSGlobalProxy::context() should not be null.", | 391 Check(ne, "JSGlobalProxy::context() should not be null.", |
| 392 holder_reg, Operand(at)); | 392 holder_reg, Operand(at)); |
| 393 | 393 |
| 394 lw(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); | 394 lw(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); |
| 395 LoadRoot(at, Heap::kGlobalContextMapRootIndex); | 395 LoadRoot(at, Heap::kNativeContextMapRootIndex); |
| 396 Check(eq, "JSGlobalObject::global_context should be a global context.", | 396 Check(eq, "JSGlobalObject::native_context should be a native context.", |
| 397 holder_reg, Operand(at)); | 397 holder_reg, Operand(at)); |
| 398 // Restore at is not needed. at is reloaded below. | 398 // Restore at is not needed. at is reloaded below. |
| 399 pop(holder_reg); // Restore holder. | 399 pop(holder_reg); // Restore holder. |
| 400 // Restore at to holder's context. | 400 // Restore at to holder's context. |
| 401 lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 401 lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
| 402 } | 402 } |
| 403 | 403 |
| 404 // Check that the security token in the calling global object is | 404 // Check that the security token in the calling global object is |
| 405 // compatible with the security token in the receiving global | 405 // compatible with the security token in the receiving global |
| 406 // object. | 406 // object. |
| (...skipping 4038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4445 | 4445 |
| 4446 | 4446 |
| 4447 void MacroAssembler::LoadTransitionedArrayMapConditional( | 4447 void MacroAssembler::LoadTransitionedArrayMapConditional( |
| 4448 ElementsKind expected_kind, | 4448 ElementsKind expected_kind, |
| 4449 ElementsKind transitioned_kind, | 4449 ElementsKind transitioned_kind, |
| 4450 Register map_in_out, | 4450 Register map_in_out, |
| 4451 Register scratch, | 4451 Register scratch, |
| 4452 Label* no_map_match) { | 4452 Label* no_map_match) { |
| 4453 // Load the global or builtins object from the current context. | 4453 // Load the global or builtins object from the current context. |
| 4454 lw(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 4454 lw(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 4455 lw(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); | 4455 lw(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); |
| 4456 | 4456 |
| 4457 // Check that the function's map is the same as the expected cached map. | 4457 // Check that the function's map is the same as the expected cached map. |
| 4458 lw(scratch, | 4458 lw(scratch, |
| 4459 MemOperand(scratch, | 4459 MemOperand(scratch, |
| 4460 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 4460 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
| 4461 size_t offset = expected_kind * kPointerSize + | 4461 size_t offset = expected_kind * kPointerSize + |
| 4462 FixedArrayBase::kHeaderSize; | 4462 FixedArrayBase::kHeaderSize; |
| 4463 lw(at, FieldMemOperand(scratch, offset)); | 4463 lw(at, FieldMemOperand(scratch, offset)); |
| 4464 Branch(no_map_match, ne, map_in_out, Operand(at)); | 4464 Branch(no_map_match, ne, map_in_out, Operand(at)); |
| 4465 | 4465 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 4491 scratch, | 4491 scratch, |
| 4492 &done); | 4492 &done); |
| 4493 } | 4493 } |
| 4494 bind(&done); | 4494 bind(&done); |
| 4495 } | 4495 } |
| 4496 | 4496 |
| 4497 | 4497 |
| 4498 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 4498 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
| 4499 // Load the global or builtins object from the current context. | 4499 // Load the global or builtins object from the current context. |
| 4500 lw(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 4500 lw(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 4501 // Load the global context from the global or builtins object. | 4501 // Load the native context from the global or builtins object. |
| 4502 lw(function, FieldMemOperand(function, | 4502 lw(function, FieldMemOperand(function, |
| 4503 GlobalObject::kGlobalContextOffset)); | 4503 GlobalObject::kNativeContextOffset)); |
| 4504 // Load the function from the global context. | 4504 // Load the function from the native context. |
| 4505 lw(function, MemOperand(function, Context::SlotOffset(index))); | 4505 lw(function, MemOperand(function, Context::SlotOffset(index))); |
| 4506 } | 4506 } |
| 4507 | 4507 |
| 4508 | 4508 |
| 4509 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 4509 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
| 4510 Register map, | 4510 Register map, |
| 4511 Register scratch) { | 4511 Register scratch) { |
| 4512 // Load the initial map. The global functions all have initial maps. | 4512 // Load the initial map. The global functions all have initial maps. |
| 4513 lw(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 4513 lw(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
| 4514 if (emit_debug_code()) { | 4514 if (emit_debug_code()) { |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5460 opcode == BGTZL); | 5460 opcode == BGTZL); |
| 5461 opcode = (cond == eq) ? BEQ : BNE; | 5461 opcode = (cond == eq) ? BEQ : BNE; |
| 5462 instr = (instr & ~kOpcodeMask) | opcode; | 5462 instr = (instr & ~kOpcodeMask) | opcode; |
| 5463 masm_.emit(instr); | 5463 masm_.emit(instr); |
| 5464 } | 5464 } |
| 5465 | 5465 |
| 5466 | 5466 |
| 5467 } } // namespace v8::internal | 5467 } } // namespace v8::internal |
| 5468 | 5468 |
| 5469 #endif // V8_TARGET_ARCH_MIPS | 5469 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |