OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 Handle<Object> value, | 1007 Handle<Object> value, |
1008 bool reversed, | 1008 bool reversed, |
1009 OverwriteMode overwrite_mode) { | 1009 OverwriteMode overwrite_mode) { |
1010 // NOTE: This is an attempt to inline (a bit) more of the code for | 1010 // NOTE: This is an attempt to inline (a bit) more of the code for |
1011 // some possible smi operations (like + and -) when (at least) one | 1011 // some possible smi operations (like + and -) when (at least) one |
1012 // of the operands is a literal smi. With this optimization, the | 1012 // of the operands is a literal smi. With this optimization, the |
1013 // performance of the system is increased by ~15%, and the generated | 1013 // performance of the system is increased by ~15%, and the generated |
1014 // code size is increased by ~1% (measured on a combination of | 1014 // code size is increased by ~1% (measured on a combination of |
1015 // different benchmarks). | 1015 // different benchmarks). |
1016 | 1016 |
1017 // TODO(1217802): Optimize some special cases of operations | 1017 // TODO(199): Optimize some special cases of operations involving a |
1018 // involving a smi literal (multiply by 2, shift by 0, etc.). | 1018 // smi literal (multiply by 2, shift by 0, etc.). |
1019 | 1019 |
1020 // Get the literal value. | 1020 // Get the literal value. |
1021 int int_value = Smi::cast(*value)->value(); | 1021 int int_value = Smi::cast(*value)->value(); |
1022 ASSERT(is_intn(int_value, kMaxSmiInlinedBits)); | 1022 ASSERT(is_intn(int_value, kMaxSmiInlinedBits)); |
1023 | 1023 |
1024 switch (op) { | 1024 switch (op) { |
1025 case Token::ADD: { | 1025 case Token::ADD: { |
1026 DeferredCode* deferred = NULL; | 1026 DeferredCode* deferred = NULL; |
1027 if (!reversed) { | 1027 if (!reversed) { |
1028 deferred = new DeferredInlinedSmiAdd(this, int_value, overwrite_mode); | 1028 deferred = new DeferredInlinedSmiAdd(this, int_value, overwrite_mode); |
(...skipping 4280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5309 | 5309 |
5310 // Slow-case: Go through the JavaScript implementation. | 5310 // Slow-case: Go through the JavaScript implementation. |
5311 __ bind(&slow); | 5311 __ bind(&slow); |
5312 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 5312 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
5313 } | 5313 } |
5314 | 5314 |
5315 | 5315 |
5316 #undef __ | 5316 #undef __ |
5317 | 5317 |
5318 } } // namespace v8::internal | 5318 } } // namespace v8::internal |
OLD | NEW |