| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 __ lea(ecx, FieldOperand(eax, Code::kHeaderSize)); | 468 __ lea(ecx, FieldOperand(eax, Code::kHeaderSize)); |
| 469 __ jmp(Operand(ecx)); | 469 __ jmp(Operand(ecx)); |
| 470 | 470 |
| 471 return GetCodeWithFlags(flags, "LazyCompileStub"); | 471 return GetCodeWithFlags(flags, "LazyCompileStub"); |
| 472 } | 472 } |
| 473 | 473 |
| 474 | 474 |
| 475 Object* CallStubCompiler::CompileCallField(Object* object, | 475 Object* CallStubCompiler::CompileCallField(Object* object, |
| 476 JSObject* holder, | 476 JSObject* holder, |
| 477 int index, | 477 int index, |
| 478 String* name, | 478 String* name) { |
| 479 Code::Flags flags) { | |
| 480 ASSERT_EQ(FIELD, Code::ExtractTypeFromFlags(flags)); | |
| 481 // ----------- S t a t e ------------- | 479 // ----------- S t a t e ------------- |
| 482 // ----------------------------------- | 480 // ----------------------------------- |
| 483 Label miss; | 481 Label miss; |
| 484 | 482 |
| 485 // Get the receiver from the stack. | 483 // Get the receiver from the stack. |
| 486 const int argc = arguments().immediate(); | 484 const int argc = arguments().immediate(); |
| 487 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 485 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
| 488 | 486 |
| 489 // Check that the receiver isn't a smi. | 487 // Check that the receiver isn't a smi. |
| 490 __ test(edx, Immediate(kSmiTagMask)); | 488 __ test(edx, Immediate(kSmiTagMask)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 511 | 509 |
| 512 // Invoke the function. | 510 // Invoke the function. |
| 513 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); | 511 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); |
| 514 | 512 |
| 515 // Handle call cache miss. | 513 // Handle call cache miss. |
| 516 __ bind(&miss); | 514 __ bind(&miss); |
| 517 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 515 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 518 __ jmp(ic, RelocInfo::CODE_TARGET); | 516 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 519 | 517 |
| 520 // Return the generated code. | 518 // Return the generated code. |
| 521 return GetCodeWithFlags(flags, name); | 519 return GetCode(FIELD, name); |
| 522 } | 520 } |
| 523 | 521 |
| 524 | 522 |
| 525 Object* CallStubCompiler::CompileCallConstant(Object* object, | 523 Object* CallStubCompiler::CompileCallConstant(Object* object, |
| 526 JSObject* holder, | 524 JSObject* holder, |
| 527 JSFunction* function, | 525 JSFunction* function, |
| 528 CheckType check, | 526 CheckType check) { |
| 529 Code::Flags flags) { | |
| 530 ASSERT_EQ(CONSTANT_FUNCTION, Code::ExtractTypeFromFlags(flags)); | |
| 531 // ----------- S t a t e ------------- | 527 // ----------- S t a t e ------------- |
| 532 // ----------------------------------- | 528 // ----------------------------------- |
| 533 Label miss; | 529 Label miss; |
| 534 | 530 |
| 535 // Get the receiver from the stack. | 531 // Get the receiver from the stack. |
| 536 const int argc = arguments().immediate(); | 532 const int argc = arguments().immediate(); |
| 537 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 533 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
| 538 | 534 |
| 539 // Check that the receiver isn't a smi. | 535 // Check that the receiver isn't a smi. |
| 540 if (check != NUMBER_CHECK) { | 536 if (check != NUMBER_CHECK) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 // Handle call cache miss. | 632 // Handle call cache miss. |
| 637 __ bind(&miss); | 633 __ bind(&miss); |
| 638 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 634 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 639 __ jmp(ic, RelocInfo::CODE_TARGET); | 635 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 640 | 636 |
| 641 // Return the generated code. | 637 // Return the generated code. |
| 642 String* function_name = NULL; | 638 String* function_name = NULL; |
| 643 if (function->shared()->name()->IsString()) { | 639 if (function->shared()->name()->IsString()) { |
| 644 function_name = String::cast(function->shared()->name()); | 640 function_name = String::cast(function->shared()->name()); |
| 645 } | 641 } |
| 646 return GetCodeWithFlags(flags, function_name); | 642 return GetCode(CONSTANT_FUNCTION, function_name); |
| 647 } | 643 } |
| 648 | 644 |
| 649 | 645 |
| 650 Object* CallStubCompiler::CompileCallInterceptor(Object* object, | 646 Object* CallStubCompiler::CompileCallInterceptor(Object* object, |
| 651 JSObject* holder, | 647 JSObject* holder, |
| 652 String* name) { | 648 String* name) { |
| 653 // ----------- S t a t e ------------- | 649 // ----------- S t a t e ------------- |
| 654 // ----------------------------------- | 650 // ----------------------------------- |
| 655 Label miss; | 651 Label miss; |
| 656 | 652 |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 __ bind(&miss); | 1087 __ bind(&miss); |
| 1092 GenerateLoadMiss(masm(), Code::LOAD_IC); | 1088 GenerateLoadMiss(masm(), Code::LOAD_IC); |
| 1093 | 1089 |
| 1094 // Return the generated code. | 1090 // Return the generated code. |
| 1095 return GetCode(INTERCEPTOR, name); | 1091 return GetCode(INTERCEPTOR, name); |
| 1096 } | 1092 } |
| 1097 | 1093 |
| 1098 | 1094 |
| 1099 Object* LoadStubCompiler::CompileLoadGlobal(JSGlobalObject* object, | 1095 Object* LoadStubCompiler::CompileLoadGlobal(JSGlobalObject* object, |
| 1100 JSGlobalPropertyCell* cell, | 1096 JSGlobalPropertyCell* cell, |
| 1101 String* name) { | 1097 String* name, |
| 1098 bool is_dont_delete) { |
| 1102 // ----------- S t a t e ------------- | 1099 // ----------- S t a t e ------------- |
| 1103 // -- ecx : name | 1100 // -- ecx : name |
| 1104 // -- esp[0] : return address | 1101 // -- esp[0] : return address |
| 1105 // -- esp[4] : receiver | 1102 // -- esp[4] : receiver |
| 1106 // ----------------------------------- | 1103 // ----------------------------------- |
| 1107 Label miss; | 1104 Label miss; |
| 1108 | 1105 |
| 1109 __ IncrementCounter(&Counters::named_load_global_inline, 1); | 1106 __ IncrementCounter(&Counters::named_load_global_inline, 1); |
| 1110 | 1107 |
| 1111 // Check that the map of the global has not changed. | 1108 // Check that the map of the global has not changed. |
| 1112 __ mov(eax, (Operand(esp, kPointerSize))); | 1109 __ mov(eax, (Operand(esp, kPointerSize))); |
| 1113 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), | 1110 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), |
| 1114 Immediate(Handle<Map>(object->map()))); | 1111 Immediate(Handle<Map>(object->map()))); |
| 1115 __ j(not_equal, &miss, not_taken); | 1112 __ j(not_equal, &miss, not_taken); |
| 1116 | 1113 |
| 1117 // Get the value from the cell. | 1114 // Get the value from the cell. |
| 1118 __ mov(eax, Immediate(Handle<JSGlobalPropertyCell>(cell))); | 1115 __ mov(eax, Immediate(Handle<JSGlobalPropertyCell>(cell))); |
| 1119 __ mov(eax, FieldOperand(eax, JSGlobalPropertyCell::kValueOffset)); | 1116 __ mov(eax, FieldOperand(eax, JSGlobalPropertyCell::kValueOffset)); |
| 1120 | 1117 |
| 1121 // Check for deleted property. | 1118 // Check for deleted property if property can actually be deleted. |
| 1122 __ cmp(eax, Factory::the_hole_value()); | 1119 if (!is_dont_delete) { |
| 1123 __ j(equal, &miss, not_taken); | 1120 __ cmp(eax, Factory::the_hole_value()); |
| 1121 __ j(equal, &miss, not_taken); |
| 1122 } |
| 1124 | 1123 |
| 1125 __ ret(0); | 1124 __ ret(0); |
| 1126 | 1125 |
| 1127 __ bind(&miss); | 1126 __ bind(&miss); |
| 1128 __ DecrementCounter(&Counters::named_load_global_inline, 1); | 1127 __ DecrementCounter(&Counters::named_load_global_inline, 1); |
| 1129 __ IncrementCounter(&Counters::named_load_global_inline_miss, 1); | 1128 __ IncrementCounter(&Counters::named_load_global_inline_miss, 1); |
| 1130 GenerateLoadMiss(masm(), Code::LOAD_IC); | 1129 GenerateLoadMiss(masm(), Code::LOAD_IC); |
| 1131 | 1130 |
| 1132 // Return the generated code. | 1131 // Return the generated code. |
| 1133 return GetCode(NORMAL, name); | 1132 return GetCode(NORMAL, name); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1333 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 1335 | 1334 |
| 1336 // Return the generated code. | 1335 // Return the generated code. |
| 1337 return GetCode(CALLBACKS, name); | 1336 return GetCode(CALLBACKS, name); |
| 1338 } | 1337 } |
| 1339 | 1338 |
| 1340 | 1339 |
| 1341 #undef __ | 1340 #undef __ |
| 1342 | 1341 |
| 1343 } } // namespace v8::internal | 1342 } } // namespace v8::internal |
| OLD | NEW |