| 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 native context of the current context. | 364 // Load the global context of the current context. |
| 365 int offset = | 365 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
| 366 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | |
| 367 lw(scratch, FieldMemOperand(scratch, offset)); | 366 lw(scratch, FieldMemOperand(scratch, offset)); |
| 368 lw(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | 367 lw(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); |
| 369 | 368 |
| 370 // Check the context is a native context. | 369 // Check the context is a global context. |
| 371 if (emit_debug_code()) { | 370 if (emit_debug_code()) { |
| 372 // TODO(119): Avoid push(holder_reg)/pop(holder_reg). | 371 // 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 global_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::kGlobalContextMapRootIndex); |
| 377 Check(eq, "JSGlobalObject::native_context should be a native context.", | 376 Check(eq, "JSGlobalObject::global_context should be a global 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::kContextOffset)); |
| 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 global context. |
| 387 if (emit_debug_code()) { | 386 if (emit_debug_code()) { |
| 388 // TODO(119): Avoid push(holder_reg)/pop(holder_reg). | 387 // TODO(119): Avoid push(holder_reg)/pop(holder_reg). |
| 389 push(holder_reg); // Temporarily save holder on the stack. | 388 push(holder_reg); // Temporarily save holder on the stack. |
| 390 mov(holder_reg, at); // Move at to its holding place. | 389 mov(holder_reg, at); // Move at to its holding place. |
| 391 LoadRoot(at, Heap::kNullValueRootIndex); | 390 LoadRoot(at, Heap::kNullValueRootIndex); |
| 392 Check(ne, "JSGlobalProxy::context() should not be null.", | 391 Check(ne, "JSGlobalProxy::context() should not be null.", |
| 393 holder_reg, Operand(at)); | 392 holder_reg, Operand(at)); |
| 394 | 393 |
| 395 lw(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); | 394 lw(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); |
| 396 LoadRoot(at, Heap::kNativeContextMapRootIndex); | 395 LoadRoot(at, Heap::kGlobalContextMapRootIndex); |
| 397 Check(eq, "JSGlobalObject::native_context should be a native context.", | 396 Check(eq, "JSGlobalObject::global_context should be a global context.", |
| 398 holder_reg, Operand(at)); | 397 holder_reg, Operand(at)); |
| 399 // Restore at is not needed. at is reloaded below. | 398 // Restore at is not needed. at is reloaded below. |
| 400 pop(holder_reg); // Restore holder. | 399 pop(holder_reg); // Restore holder. |
| 401 // Restore at to holder's context. | 400 // Restore at to holder's context. |
| 402 lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | 401 lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
| 403 } | 402 } |
| 404 | 403 |
| 405 // Check that the security token in the calling global object is | 404 // Check that the security token in the calling global object is |
| 406 // compatible with the security token in the receiving global | 405 // compatible with the security token in the receiving global |
| 407 // object. | 406 // object. |
| 408 int token_offset = Context::kHeaderSize + | 407 int token_offset = Context::kHeaderSize + |
| 409 Context::SECURITY_TOKEN_INDEX * kPointerSize; | 408 Context::SECURITY_TOKEN_INDEX * kPointerSize; |
| 410 | 409 |
| 411 lw(scratch, FieldMemOperand(scratch, token_offset)); | 410 lw(scratch, FieldMemOperand(scratch, token_offset)); |
| 412 lw(at, FieldMemOperand(at, token_offset)); | 411 lw(at, FieldMemOperand(at, token_offset)); |
| (...skipping 3863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4276 ASSERT(flag == JUMP_FUNCTION); | 4275 ASSERT(flag == JUMP_FUNCTION); |
| 4277 SetCallKind(t1, CALL_AS_METHOD); | 4276 SetCallKind(t1, CALL_AS_METHOD); |
| 4278 Jump(t9); | 4277 Jump(t9); |
| 4279 } | 4278 } |
| 4280 } | 4279 } |
| 4281 | 4280 |
| 4282 | 4281 |
| 4283 void MacroAssembler::GetBuiltinFunction(Register target, | 4282 void MacroAssembler::GetBuiltinFunction(Register target, |
| 4284 Builtins::JavaScript id) { | 4283 Builtins::JavaScript id) { |
| 4285 // Load the builtins object into target register. | 4284 // Load the builtins object into target register. |
| 4286 lw(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 4285 lw(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 4287 lw(target, FieldMemOperand(target, GlobalObject::kBuiltinsOffset)); | 4286 lw(target, FieldMemOperand(target, GlobalObject::kBuiltinsOffset)); |
| 4288 // Load the JavaScript builtin function from the builtins object. | 4287 // Load the JavaScript builtin function from the builtins object. |
| 4289 lw(target, FieldMemOperand(target, | 4288 lw(target, FieldMemOperand(target, |
| 4290 JSBuiltinsObject::OffsetOfFunctionWithId(id))); | 4289 JSBuiltinsObject::OffsetOfFunctionWithId(id))); |
| 4291 } | 4290 } |
| 4292 | 4291 |
| 4293 | 4292 |
| 4294 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { | 4293 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { |
| 4295 ASSERT(!target.is(a1)); | 4294 ASSERT(!target.is(a1)); |
| 4296 GetBuiltinFunction(a1, id); | 4295 GetBuiltinFunction(a1, id); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4445 } | 4444 } |
| 4446 | 4445 |
| 4447 | 4446 |
| 4448 void MacroAssembler::LoadTransitionedArrayMapConditional( | 4447 void MacroAssembler::LoadTransitionedArrayMapConditional( |
| 4449 ElementsKind expected_kind, | 4448 ElementsKind expected_kind, |
| 4450 ElementsKind transitioned_kind, | 4449 ElementsKind transitioned_kind, |
| 4451 Register map_in_out, | 4450 Register map_in_out, |
| 4452 Register scratch, | 4451 Register scratch, |
| 4453 Label* no_map_match) { | 4452 Label* no_map_match) { |
| 4454 // Load the global or builtins object from the current context. | 4453 // Load the global or builtins object from the current context. |
| 4455 lw(scratch, | 4454 lw(scratch, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 4456 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 4455 lw(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); |
| 4457 lw(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | |
| 4458 | 4456 |
| 4459 // 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. |
| 4460 lw(scratch, | 4458 lw(scratch, |
| 4461 MemOperand(scratch, | 4459 MemOperand(scratch, |
| 4462 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 4460 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
| 4463 size_t offset = expected_kind * kPointerSize + | 4461 size_t offset = expected_kind * kPointerSize + |
| 4464 FixedArrayBase::kHeaderSize; | 4462 FixedArrayBase::kHeaderSize; |
| 4465 lw(at, FieldMemOperand(scratch, offset)); | 4463 lw(at, FieldMemOperand(scratch, offset)); |
| 4466 Branch(no_map_match, ne, map_in_out, Operand(at)); | 4464 Branch(no_map_match, ne, map_in_out, Operand(at)); |
| 4467 | 4465 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 4492 map_out, | 4490 map_out, |
| 4493 scratch, | 4491 scratch, |
| 4494 &done); | 4492 &done); |
| 4495 } | 4493 } |
| 4496 bind(&done); | 4494 bind(&done); |
| 4497 } | 4495 } |
| 4498 | 4496 |
| 4499 | 4497 |
| 4500 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 4498 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
| 4501 // Load the global or builtins object from the current context. | 4499 // Load the global or builtins object from the current context. |
| 4502 lw(function, | 4500 lw(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 4503 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 4501 // Load the global context from the global or builtins object. |
| 4504 // Load the native context from the global or builtins object. | |
| 4505 lw(function, FieldMemOperand(function, | 4502 lw(function, FieldMemOperand(function, |
| 4506 GlobalObject::kNativeContextOffset)); | 4503 GlobalObject::kGlobalContextOffset)); |
| 4507 // Load the function from the native context. | 4504 // Load the function from the global context. |
| 4508 lw(function, MemOperand(function, Context::SlotOffset(index))); | 4505 lw(function, MemOperand(function, Context::SlotOffset(index))); |
| 4509 } | 4506 } |
| 4510 | 4507 |
| 4511 | 4508 |
| 4512 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 4509 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
| 4513 Register map, | 4510 Register map, |
| 4514 Register scratch) { | 4511 Register scratch) { |
| 4515 // Load the initial map. The global functions all have initial maps. | 4512 // Load the initial map. The global functions all have initial maps. |
| 4516 lw(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 4513 lw(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
| 4517 if (emit_debug_code()) { | 4514 if (emit_debug_code()) { |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5465 opcode == BGTZL); | 5462 opcode == BGTZL); |
| 5466 opcode = (cond == eq) ? BEQ : BNE; | 5463 opcode = (cond == eq) ? BEQ : BNE; |
| 5467 instr = (instr & ~kOpcodeMask) | opcode; | 5464 instr = (instr & ~kOpcodeMask) | opcode; |
| 5468 masm_.emit(instr); | 5465 masm_.emit(instr); |
| 5469 } | 5466 } |
| 5470 | 5467 |
| 5471 | 5468 |
| 5472 } } // namespace v8::internal | 5469 } } // namespace v8::internal |
| 5473 | 5470 |
| 5474 #endif // V8_TARGET_ARCH_MIPS | 5471 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |