Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Issue 11098009: Implement SmiToInt and DoubleToInt. (Closed)

Created:
8 years, 2 months ago by srdjan
Modified:
8 years, 2 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Implement SmiToInt and DoubleToInt. All necessary tests are in tests/language/arithmetic_test.dart Committed: https://code.google.com/p/dart/source/detail?r=13443

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 12

Patch Set 5 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+171 lines, -3 lines) Patch
M runtime/vm/disassembler_ia32.cc View 1 2 3 4 3 chunks +3 lines, -1 line 0 comments Download
M runtime/vm/flow_graph_optimizer.cc View 1 2 3 4 4 chunks +34 lines, -1 line 0 comments Download
M runtime/vm/intermediate_language.h View 1 2 3 4 3 chunks +33 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language.cc View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_ia32.cc View 1 2 3 4 2 chunks +46 lines, -1 line 0 comments Download
M runtime/vm/intermediate_language_x64.cc View 1 2 3 4 1 chunk +49 lines, -0 lines 0 comments Download
M tests/language/arithmetic_test.dart View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
srdjan
8 years, 2 months ago (2012-10-09 00:38:09 UTC) #1
cshapiro
https://codereview.chromium.org/11098009/diff/10001/runtime/vm/intermediate_language_x64.cc File runtime/vm/intermediate_language_x64.cc (right): https://codereview.chromium.org/11098009/diff/10001/runtime/vm/intermediate_language_x64.cc#newcode1994 runtime/vm/intermediate_language_x64.cc:1994: __ cmpq(result, Immediate(0xC000000000000000)); Why not use SH SHL result, ...
8 years, 2 months ago (2012-10-09 00:59:23 UTC) #2
Florian Schneider
LGTM with comments https://codereview.chromium.org/11098009/diff/10001/runtime/vm/flow_graph_optimizer.cc File runtime/vm/flow_graph_optimizer.cc (right): https://codereview.chromium.org/11098009/diff/10001/runtime/vm/flow_graph_optimizer.cc#newcode927 runtime/vm/flow_graph_optimizer.cc:927: call->ReplaceWith(int2int_instr, current_iterator()); Since IntegerToInteger itself is ...
8 years, 2 months ago (2012-10-09 11:13:58 UTC) #3
srdjan
8 years, 2 months ago (2012-10-09 21:23:04 UTC) #4
https://codereview.chromium.org/11098009/diff/10001/runtime/vm/flow_graph_opt...
File runtime/vm/flow_graph_optimizer.cc (right):

https://codereview.chromium.org/11098009/diff/10001/runtime/vm/flow_graph_opt...
runtime/vm/flow_graph_optimizer.cc:927: call->ReplaceWith(int2int_instr,
current_iterator());
On 2012/10/09 11:13:58, Florian Schneider wrote:
> Since IntegerToInteger itself is a nop, I think you can avoid having an extra
IL
> instruction for Integer.toInt. Just do a CheckSmi/ClassCheck and then replace
> all uses of the call with the input:
> 
> call->ReplaceUsesWith(call->ArgumentAt(0)->value());
> 

Done.

https://codereview.chromium.org/11098009/diff/10001/runtime/vm/intermediate_l...
File runtime/vm/intermediate_language_ia32.cc (right):

https://codereview.chromium.org/11098009/diff/10001/runtime/vm/intermediate_l...
runtime/vm/intermediate_language_ia32.cc:2020: __ movl(value_obj, Address(ESP,
0));
On 2012/10/09 11:13:58, Florian Schneider wrote:
> Alternatively, you could make the instruction take 1 input operand in a
register
> and push the argument explicitly before the call and drop it after the call.

Done.

https://codereview.chromium.org/11098009/diff/10001/runtime/vm/intermediate_l...
runtime/vm/intermediate_language_ia32.cc:2022: __ cvttsd2si(result,
value_double);
On 2012/10/09 11:13:58, Florian Schneider wrote:
> Please add this instruction to the disassembler. I noticed it is still
missing.

Done.

https://codereview.chromium.org/11098009/diff/10001/runtime/vm/intermediate_l...
File runtime/vm/intermediate_language_x64.cc (right):

https://codereview.chromium.org/11098009/diff/10001/runtime/vm/intermediate_l...
runtime/vm/intermediate_language_x64.cc:1990: __ cvttsd2siq(result,
value_double);
On 2012/10/09 11:13:58, Florian Schneider wrote:
> Please make sure that the tests cover the corner cases like NaN and
+/-Infinity.

Yes, this is covered in arithmetic_test.dart (throw exception).

https://codereview.chromium.org/11098009/diff/10001/runtime/vm/intermediate_l...
runtime/vm/intermediate_language_x64.cc:1994: __ cmpq(result,
Immediate(0xC000000000000000));
On 2012/10/09 00:59:24, cshapiro wrote:
> Why not use SH
> 
>  SHL result, 1
>  JO <overflow>
> 
> The overflow bit is set to the XOR of the CF and the MSB.
> 
> If the value of result is ever needed you can
> 
>   RCR result, 1
> 
> to restore the MSB from the CF.  With an argument of 1 this is a single cycle
> instruction.

Done, using a temporary register to preserve result.

https://codereview.chromium.org/11098009/diff/10001/runtime/vm/intermediate_l...
runtime/vm/intermediate_language_x64.cc:2010: Array::Handle(),  // No argument
names.,
On 2012/10/09 11:13:58, Florian Schneider wrote:
> Remove extra , at the end.

Done.

Powered by Google App Engine
This is Rietveld 408576698