 Chromium Code Reviews
 Chromium Code Reviews Issue 160041:
  Stub Cache: speed up load callback accessor by allocating data handle on stack.  (Closed)
    
  
    Issue 160041:
  Stub Cache: speed up load callback accessor by allocating data handle on stack.  (Closed) 
  | 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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 729 | 729 | 
| 730 // Support function for computing call IC miss stubs. | 730 // Support function for computing call IC miss stubs. | 
| 731 Handle<Code> ComputeCallMiss(int argc) { | 731 Handle<Code> ComputeCallMiss(int argc) { | 
| 732 CALL_HEAP_FUNCTION(StubCache::ComputeCallMiss(argc), Code); | 732 CALL_HEAP_FUNCTION(StubCache::ComputeCallMiss(argc), Code); | 
| 733 } | 733 } | 
| 734 | 734 | 
| 735 | 735 | 
| 736 | 736 | 
| 737 Object* LoadCallbackProperty(Arguments args) { | 737 Object* LoadCallbackProperty(Arguments args) { | 
| 738 Handle<JSObject> recv = args.at<JSObject>(0); | 738 Handle<JSObject> recv = args.at<JSObject>(0); | 
| 739 AccessorInfo* callback = AccessorInfo::cast(args[1]); | 739 Handle<JSObject> holder = args.at<JSObject>(1); | 
| 740 AccessorInfo* callback = AccessorInfo::cast(args[2]); | |
| 741 Handle<Object> data = args.at<Object>(3); | |
| 
Christian Plesner Hansen
2009/07/24 07:33:25
A further optimization could be to change the impl
 
Vitaly Repeshko
2009/07/24 13:45:38
Sure. After this patch is in, I was going to exper
 | |
| 740 Address getter_address = v8::ToCData<Address>(callback->getter()); | 742 Address getter_address = v8::ToCData<Address>(callback->getter()); | 
| 
antonm
2009/07/23 21:12:58
maybe compile getter_address into stub as well?  A
 
Vitaly Repeshko
2009/07/24 13:45:38
I think this essentially means moving a few instru
 
Vitaly Repeshko
2009/07/24 15:43:56
Anton pointed out in offline discussion that we st
 | |
| 741 v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address); | 743 v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address); | 
| 742 ASSERT(fun != NULL); | 744 ASSERT(fun != NULL); | 
| 743 Handle<String> name = args.at<String>(2); | 745 Handle<String> name = args.at<String>(4); | 
| 744 Handle<JSObject> holder = args.at<JSObject>(3); | |
| 745 HandleScope scope; | |
| 746 Handle<Object> data(callback->data()); | |
| 747 LOG(ApiNamedPropertyAccess("load", *recv, *name)); | |
| 748 // NOTE: If we can align the structure of an AccessorInfo with the | 746 // NOTE: If we can align the structure of an AccessorInfo with the | 
| 749 // locations of the arguments to this function maybe we don't have | 747 // locations of the arguments to this function maybe we don't have | 
| 750 // to explicitly create the structure but can just pass a pointer | 748 // to explicitly create the structure but can just pass a pointer | 
| 751 // into the stack. | 749 // into the stack. | 
| 750 LOG(ApiNamedPropertyAccess("load", *recv, *name)); | |
| 
iposva
2009/07/24 00:30:07
Do you really intend to log for every single prope
 
Christian Plesner Hansen
2009/07/24 07:33:25
I agree.  It looks like we're already losing perfo
 
Vitaly Repeshko
2009/07/24 13:45:38
Well, this does cost us a bit, but I'm not sure I
 | |
| 752 v8::AccessorInfo info(v8::Utils::ToLocal(recv), | 751 v8::AccessorInfo info(v8::Utils::ToLocal(recv), | 
| 753 v8::Utils::ToLocal(data), | 752 v8::Utils::ToLocal(data), | 
| 754 v8::Utils::ToLocal(holder)); | 753 v8::Utils::ToLocal(holder)); | 
| 754 HandleScope scope; | |
| 
antonm
2009/07/23 21:12:58
maybe move scope just before entering fun?  for ex
 
iposva
2009/07/24 00:30:07
And where would the result handle on the next line
 
antonm
2009/07/24 02:43:21
Correct me if I'm wrong, but v8::Handle::Handle()
 
Christian Plesner Hansen
2009/07/24 07:33:25
If you move the handle scope into the inner scope
 
antonm
2009/07/24 08:59:34
Aha, stupid me.
 | |
| 755 v8::Handle<v8::Value> result; | 755 v8::Handle<v8::Value> result; | 
| 756 { | 756 { | 
| 757 // Leaving JavaScript. | 757 // Leaving JavaScript. | 
| 758 VMState state(EXTERNAL); | 758 VMState state(EXTERNAL); | 
| 759 result = fun(v8::Utils::ToLocal(name), info); | 759 result = fun(v8::Utils::ToLocal(name), info); | 
| 760 } | 760 } | 
| 761 RETURN_IF_SCHEDULED_EXCEPTION(); | 761 RETURN_IF_SCHEDULED_EXCEPTION(); | 
| 762 if (result.IsEmpty()) return Heap::undefined_value(); | 762 if (result.IsEmpty()) return Heap::undefined_value(); | 
| 763 return *v8::Utils::OpenHandle(*result); | 763 return *v8::Utils::OpenHandle(*result); | 
| 764 } | 764 } | 
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1011 int argc = arguments_.immediate(); | 1011 int argc = arguments_.immediate(); | 
| 1012 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, | 1012 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, | 
| 1013 type, | 1013 type, | 
| 1014 in_loop_, | 1014 in_loop_, | 
| 1015 argc); | 1015 argc); | 
| 1016 return GetCodeWithFlags(flags, name); | 1016 return GetCodeWithFlags(flags, name); | 
| 1017 } | 1017 } | 
| 1018 | 1018 | 
| 1019 | 1019 | 
| 1020 } } // namespace v8::internal | 1020 } } // namespace v8::internal | 
| OLD | NEW |