mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* compile.c (when_vals): when a string literal is written on when
clause, skip string creation to make it faster. [ruby-dev:44068] [Feature #5000] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b0f115da1a
commit
b88daae7ec
2 changed files with 14 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
Sun Jul 10 12:08:39 2011 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* compile.c (when_vals): when a string literal is written on when
|
||||
clause, skip string creation to make it faster. [ruby-dev:44068]
|
||||
[Feature #5000]
|
||||
|
||||
Sun Jul 10 11:35:29 2011 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* parse.y (reduce_nodes_gen): NODE_RETURN in rescue body must not be
|
||||
|
|
|
@ -2362,7 +2362,14 @@ when_vals(rb_iseq_t *iseq, LINK_ANCHOR *cond_seq, NODE *vals, LABEL *l1, VALUE s
|
|||
special_literals = Qfalse;
|
||||
}
|
||||
|
||||
COMPILE(cond_seq, "when cond", val);
|
||||
if (nd_type(val) == NODE_STR) {
|
||||
debugp_param("nd_lit", val->nd_lit);
|
||||
OBJ_FREEZE(val->nd_lit);
|
||||
ADD_INSN1(cond_seq, nd_line(val), putobject, val->nd_lit);
|
||||
}
|
||||
else {
|
||||
COMPILE(cond_seq, "when cond", val);
|
||||
}
|
||||
ADD_INSN1(cond_seq, nd_line(val), topn, INT2FIX(1));
|
||||
ADD_SEND(cond_seq, nd_line(val), ID2SYM(idEqq), INT2FIX(1));
|
||||
ADD_INSNL(cond_seq, nd_line(val), branchif, l1);
|
||||
|
|
Loading…
Add table
Reference in a new issue