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

Side by Side Diff: src/full-codegen.h

Issue 3195028: Add inlining of binary smi operations in the full codegens on IA32... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ast.h ('k') | src/full-codegen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 private: 230 private:
231 static const int kForInStackElementCount = 5; 231 static const int kForInStackElementCount = 5;
232 DISALLOW_COPY_AND_ASSIGN(ForIn); 232 DISALLOW_COPY_AND_ASSIGN(ForIn);
233 }; 233 };
234 234
235 enum Location { 235 enum Location {
236 kAccumulator, 236 kAccumulator,
237 kStack 237 kStack
238 }; 238 };
239 239
240 enum ConstantOperand {
241 kNoConstants,
242 kLeftConstant,
243 kRightConstant
244 };
245
240 // Compute the frame pointer relative offset for a given local or 246 // Compute the frame pointer relative offset for a given local or
241 // parameter slot. 247 // parameter slot.
242 int SlotOffset(Slot* slot); 248 int SlotOffset(Slot* slot);
243 249
244 // Determine whether or not to inline the smi case for the given 250 // Determine whether or not to inline the smi case for the given
245 // operation. 251 // operation.
246 bool ShouldInlineSmiCase(Token::Value op); 252 bool ShouldInlineSmiCase(Token::Value op);
247 253
254 // Compute which (if any) of the operands is a compile-time constant.
255 ConstantOperand GetConstantOperand(Token::Value op,
256 Expression* left,
257 Expression* right);
258
248 // Emit code to convert a pure value (in a register, slot, as a literal, 259 // Emit code to convert a pure value (in a register, slot, as a literal,
249 // or on top of the stack) into the result expected according to an 260 // or on top of the stack) into the result expected according to an
250 // expression context. 261 // expression context.
251 void Apply(Expression::Context context, Register reg); 262 void Apply(Expression::Context context, Register reg);
252 263
253 // Slot cannot have type Slot::LOOKUP. 264 // Slot cannot have type Slot::LOOKUP.
254 void Apply(Expression::Context context, Slot* slot); 265 void Apply(Expression::Context context, Slot* slot);
255 266
256 void Apply(Expression::Context context, Literal* lit); 267 void Apply(Expression::Context context, Literal* lit);
257 void ApplyTOS(Expression::Context context); 268 void ApplyTOS(Expression::Context context);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 FunctionLiteral* function); 365 FunctionLiteral* function);
355 366
356 // Platform-specific return sequence 367 // Platform-specific return sequence
357 void EmitReturnSequence(); 368 void EmitReturnSequence();
358 369
359 // Platform-specific code sequences for calls 370 // Platform-specific code sequences for calls
360 void EmitCallWithStub(Call* expr); 371 void EmitCallWithStub(Call* expr);
361 void EmitCallWithIC(Call* expr, Handle<Object> name, RelocInfo::Mode mode); 372 void EmitCallWithIC(Call* expr, Handle<Object> name, RelocInfo::Mode mode);
362 void EmitKeyedCallWithIC(Call* expr, Expression* key, RelocInfo::Mode mode); 373 void EmitKeyedCallWithIC(Call* expr, Expression* key, RelocInfo::Mode mode);
363 374
364
365 // Platform-specific code for inline runtime calls. 375 // Platform-specific code for inline runtime calls.
366 void EmitInlineRuntimeCall(CallRuntime* expr); 376 void EmitInlineRuntimeCall(CallRuntime* expr);
367 377
368 #define EMIT_INLINE_RUNTIME_CALL(name, x, y) \ 378 #define EMIT_INLINE_RUNTIME_CALL(name, x, y) \
369 void Emit##name(ZoneList<Expression*>* arguments); 379 void Emit##name(ZoneList<Expression*>* arguments);
370 INLINE_RUNTIME_FUNCTION_LIST(EMIT_INLINE_RUNTIME_CALL) 380 INLINE_RUNTIME_FUNCTION_LIST(EMIT_INLINE_RUNTIME_CALL)
371 #undef EMIT_INLINE_RUNTIME_CALL 381 #undef EMIT_INLINE_RUNTIME_CALL
372 382
373 // Platform-specific code for loading variables. 383 // Platform-specific code for loading variables.
374 void EmitVariableLoad(Variable* expr, Expression::Context context); 384 void EmitVariableLoad(Variable* expr, Expression::Context context);
(...skipping 11 matching lines...) Expand all
386 // Load a value from a keyed property. 396 // Load a value from a keyed property.
387 // The receiver and the key is left on the stack by the IC. 397 // The receiver and the key is left on the stack by the IC.
388 void EmitKeyedPropertyLoad(Property* expr); 398 void EmitKeyedPropertyLoad(Property* expr);
389 399
390 // Apply the compound assignment operator. Expects the left operand on top 400 // Apply the compound assignment operator. Expects the left operand on top
391 // of the stack and the right one in the accumulator. 401 // of the stack and the right one in the accumulator.
392 void EmitBinaryOp(Token::Value op, 402 void EmitBinaryOp(Token::Value op,
393 Expression::Context context, 403 Expression::Context context,
394 OverwriteMode mode); 404 OverwriteMode mode);
395 405
406 // Helper functions for generating inlined smi code for certain
407 // binary operations.
408 void EmitInlineSmiBinaryOp(Expression* expr,
409 Token::Value op,
410 Expression::Context context,
411 OverwriteMode mode,
412 Expression* left,
413 Expression* right,
414 ConstantOperand constant);
415
416 void EmitConstantSmiBinaryOp(Expression* expr,
417 Token::Value op,
418 Expression::Context context,
419 OverwriteMode mode,
420 bool left_is_constant_smi,
421 Smi* value);
422
423 void EmitConstantSmiBitOp(Expression* expr,
424 Token::Value op,
425 Expression::Context context,
426 OverwriteMode mode,
427 Smi* value);
428
429 void EmitConstantSmiShiftOp(Expression* expr,
430 Token::Value op,
431 Expression::Context context,
432 OverwriteMode mode,
433 Smi* value);
434
435 void EmitConstantSmiAdd(Expression* expr,
436 Expression::Context context,
437 OverwriteMode mode,
438 bool left_is_constant_smi,
439 Smi* value);
440
441 void EmitConstantSmiSub(Expression* expr,
442 Expression::Context context,
443 OverwriteMode mode,
444 bool left_is_constant_smi,
445 Smi* value);
446
396 // Assign to the given expression as if via '='. The right-hand-side value 447 // Assign to the given expression as if via '='. The right-hand-side value
397 // is expected in the accumulator. 448 // is expected in the accumulator.
398 void EmitAssignment(Expression* expr); 449 void EmitAssignment(Expression* expr);
399 450
400 // Complete a variable assignment. The right-hand-side value is expected 451 // Complete a variable assignment. The right-hand-side value is expected
401 // in the accumulator. 452 // in the accumulator.
402 void EmitVariableAssignment(Variable* var, 453 void EmitVariableAssignment(Variable* var,
403 Token::Value op, 454 Token::Value op,
404 Expression::Context context); 455 Expression::Context context);
405 456
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 530
480 friend class NestedStatement; 531 friend class NestedStatement;
481 532
482 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); 533 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator);
483 }; 534 };
484 535
485 536
486 } } // namespace v8::internal 537 } } // namespace v8::internal
487 538
488 #endif // V8_FULL_CODEGEN_H_ 539 #endif // V8_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698