OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
396 // -- rsp[kFastApiCallArguments * 8 + 8] : last argument in the internal | 396 // -- rsp[kFastApiCallArguments * 8 + 8] : last argument in the internal |
397 // frame. | 397 // frame. |
398 // ----------------------------------- | 398 // ----------------------------------- |
399 __ movq(scratch, Operand(rsp, 0)); | 399 __ movq(scratch, Operand(rsp, 0)); |
400 __ movq(Operand(rsp, kFastApiCallArguments * kPointerSize), scratch); | 400 __ movq(Operand(rsp, kFastApiCallArguments * kPointerSize), scratch); |
401 __ addq(rsp, Immediate(kPointerSize * kFastApiCallArguments)); | 401 __ addq(rsp, Immediate(kPointerSize * kFastApiCallArguments)); |
402 } | 402 } |
403 | 403 |
404 | 404 |
405 // Generates call to API function. | 405 // Generates call to API function. |
406 static MaybeObject* GenerateFastApiCall(MacroAssembler* masm, | 406 static MaybeObject* GenerateFastApiCall(MacroAssembler* masm, |
Vyacheslav Egorov (Chromium)
2011/10/12 12:36:05
check all callers for gc safeness.
| |
407 const CallOptimization& optimization, | 407 const CallOptimization& optimization, |
408 int argc) { | 408 int argc) { |
409 // ----------- S t a t e ------------- | 409 // ----------- S t a t e ------------- |
410 // -- rsp[0] : return address | 410 // -- rsp[0] : return address |
411 // -- rsp[8] : object passing the type check | 411 // -- rsp[8] : object passing the type check |
412 // (last fast api call extra argument, | 412 // (last fast api call extra argument, |
413 // set by CheckPrototypes) | 413 // set by CheckPrototypes) |
414 // -- rsp[16] : api function | 414 // -- rsp[16] : api function |
415 // (first fast api call extra argument) | 415 // (first fast api call extra argument) |
416 // -- rsp[24] : api call data | 416 // -- rsp[24] : api call data |
417 // -- rsp[32] : last argument | 417 // -- rsp[32] : last argument |
418 // -- ... | 418 // -- ... |
419 // -- rsp[(argc + 3) * 8] : first argument | 419 // -- rsp[(argc + 3) * 8] : first argument |
420 // -- rsp[(argc + 4) * 8] : receiver | 420 // -- rsp[(argc + 4) * 8] : receiver |
421 // ----------------------------------- | 421 // ----------------------------------- |
422 // Get the function and setup the context. | 422 // Get the function and setup the context. |
423 JSFunction* function = optimization.constant_function(); | 423 JSFunction* function = optimization.constant_function(); |
424 __ Move(rdi, Handle<JSFunction>(function)); | 424 __ LoadHeapObject(rdi, Handle<JSFunction>(function)); |
425 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 425 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
426 | 426 |
427 // Pass the additional arguments. | 427 // Pass the additional arguments. |
428 __ movq(Operand(rsp, 2 * kPointerSize), rdi); | 428 __ movq(Operand(rsp, 2 * kPointerSize), rdi); |
429 Object* call_data = optimization.api_call_info()->data(); | 429 Object* call_data = optimization.api_call_info()->data(); |
430 Handle<CallHandlerInfo> api_call_info_handle(optimization.api_call_info()); | 430 Handle<CallHandlerInfo> api_call_info_handle(optimization.api_call_info()); |
431 if (masm->isolate()->heap()->InNewSpace(call_data)) { | 431 if (masm->isolate()->heap()->InNewSpace(call_data)) { |
432 __ Move(rcx, api_call_info_handle); | 432 __ Move(rcx, api_call_info_handle); |
433 __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); | 433 __ movq(rbx, FieldOperand(rcx, CallHandlerInfo::kDataOffset)); |
434 __ movq(Operand(rsp, 3 * kPointerSize), rbx); | 434 __ movq(Operand(rsp, 3 * kPointerSize), rbx); |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1074 __ lea(accessor_info_arg, StackSpaceOperand(0)); | 1074 __ lea(accessor_info_arg, StackSpaceOperand(0)); |
1075 | 1075 |
1076 // Emitting a stub call may try to allocate (if the code is not | 1076 // Emitting a stub call may try to allocate (if the code is not |
1077 // already generated). Do not allow the assembler to perform a | 1077 // already generated). Do not allow the assembler to perform a |
1078 // garbage collection but instead return the allocation failure | 1078 // garbage collection but instead return the allocation failure |
1079 // object. | 1079 // object. |
1080 return masm()->TryCallApiFunctionAndReturn(&fun, kStackSpace); | 1080 return masm()->TryCallApiFunctionAndReturn(&fun, kStackSpace); |
1081 } | 1081 } |
1082 | 1082 |
1083 | 1083 |
1084 void StubCompiler::GenerateLoadConstant(JSObject* object, | 1084 void StubCompiler::GenerateLoadConstant(JSObject* object, |
Vyacheslav Egorov (Chromium)
2011/10/12 12:36:05
check all callers for gc safeness.
| |
1085 JSObject* holder, | 1085 JSObject* holder, |
1086 Register receiver, | 1086 Register receiver, |
1087 Register scratch1, | 1087 Register scratch1, |
1088 Register scratch2, | 1088 Register scratch2, |
1089 Register scratch3, | 1089 Register scratch3, |
1090 Object* value, | 1090 JSFunction* value, |
1091 String* name, | 1091 String* name, |
1092 Label* miss) { | 1092 Label* miss) { |
1093 // Check that the receiver isn't a smi. | 1093 // Check that the receiver isn't a smi. |
1094 __ JumpIfSmi(receiver, miss); | 1094 __ JumpIfSmi(receiver, miss); |
1095 | 1095 |
1096 // Check that the maps haven't changed. | 1096 // Check that the maps haven't changed. |
1097 CheckPrototypes(object, receiver, holder, | 1097 CheckPrototypes(object, receiver, holder, |
1098 scratch1, scratch2, scratch3, name, miss); | 1098 scratch1, scratch2, scratch3, name, miss); |
1099 | 1099 |
1100 // Return the constant value. | 1100 // Return the constant value. |
1101 __ Move(rax, Handle<Object>(value)); | 1101 __ LoadHeapObject(rax, Handle<JSFunction>(value)); |
1102 __ ret(0); | 1102 __ ret(0); |
1103 } | 1103 } |
1104 | 1104 |
1105 | 1105 |
1106 void StubCompiler::GenerateLoadInterceptor(JSObject* object, | 1106 void StubCompiler::GenerateLoadInterceptor(JSObject* object, |
1107 JSObject* interceptor_holder, | 1107 JSObject* interceptor_holder, |
1108 LookupResult* lookup, | 1108 LookupResult* lookup, |
1109 Register receiver, | 1109 Register receiver, |
1110 Register name_reg, | 1110 Register name_reg, |
1111 Register scratch1, | 1111 Register scratch1, |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2722 __ bind(&miss); | 2722 __ bind(&miss); |
2723 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2723 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2724 | 2724 |
2725 // Return the generated code. | 2725 // Return the generated code. |
2726 return GetCode(CALLBACKS, name); | 2726 return GetCode(CALLBACKS, name); |
2727 } | 2727 } |
2728 | 2728 |
2729 | 2729 |
2730 MaybeObject* LoadStubCompiler::CompileLoadConstant(JSObject* object, | 2730 MaybeObject* LoadStubCompiler::CompileLoadConstant(JSObject* object, |
2731 JSObject* holder, | 2731 JSObject* holder, |
2732 Object* value, | 2732 JSFunction* value, |
2733 String* name) { | 2733 String* name) { |
2734 // ----------- S t a t e ------------- | 2734 // ----------- S t a t e ------------- |
2735 // -- rax : receiver | 2735 // -- rax : receiver |
2736 // -- rcx : name | 2736 // -- rcx : name |
2737 // -- rsp[0] : return address | 2737 // -- rsp[0] : return address |
2738 // ----------------------------------- | 2738 // ----------------------------------- |
2739 Label miss; | 2739 Label miss; |
2740 | 2740 |
2741 GenerateLoadConstant(object, holder, rax, rbx, rdx, rdi, value, name, &miss); | 2741 GenerateLoadConstant(object, holder, rax, rbx, rdx, rdi, value, name, &miss); |
2742 __ bind(&miss); | 2742 __ bind(&miss); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2891 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2891 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2892 | 2892 |
2893 // Return the generated code. | 2893 // Return the generated code. |
2894 return GetCode(CALLBACKS, name); | 2894 return GetCode(CALLBACKS, name); |
2895 } | 2895 } |
2896 | 2896 |
2897 | 2897 |
2898 MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name, | 2898 MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name, |
2899 JSObject* receiver, | 2899 JSObject* receiver, |
2900 JSObject* holder, | 2900 JSObject* holder, |
2901 Object* value) { | 2901 JSFunction* value) { |
2902 // ----------- S t a t e ------------- | 2902 // ----------- S t a t e ------------- |
2903 // -- rax : key | 2903 // -- rax : key |
2904 // -- rdx : receiver | 2904 // -- rdx : receiver |
2905 // -- rsp[0] : return address | 2905 // -- rsp[0] : return address |
2906 // ----------------------------------- | 2906 // ----------------------------------- |
2907 Label miss; | 2907 Label miss; |
2908 | 2908 |
2909 Counters* counters = isolate()->counters(); | 2909 Counters* counters = isolate()->counters(); |
2910 __ IncrementCounter(counters->keyed_load_constant_function(), 1); | 2910 __ IncrementCounter(counters->keyed_load_constant_function(), 1); |
2911 | 2911 |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3785 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3785 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
3786 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3786 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); |
3787 } | 3787 } |
3788 | 3788 |
3789 | 3789 |
3790 #undef __ | 3790 #undef __ |
3791 | 3791 |
3792 } } // namespace v8::internal | 3792 } } // namespace v8::internal |
3793 | 3793 |
3794 #endif // V8_TARGET_ARCH_X64 | 3794 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |