| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/base/compiler-specific.h" | 9 #include "src/base/compiler-specific.h" |
| 10 #include "src/globals.h" | 10 #include "src/globals.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 290 |
| 291 // Operators (register holds the lhs value, accumulator holds the rhs value). | 291 // Operators (register holds the lhs value, accumulator holds the rhs value). |
| 292 // Type feedback will be recorded in the |feedback_slot| | 292 // Type feedback will be recorded in the |feedback_slot| |
| 293 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg, | 293 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg, |
| 294 int feedback_slot); | 294 int feedback_slot); |
| 295 | 295 |
| 296 // Count Operators (value stored in accumulator). | 296 // Count Operators (value stored in accumulator). |
| 297 // Type feedback will be recorded in the |feedback_slot| | 297 // Type feedback will be recorded in the |feedback_slot| |
| 298 BytecodeArrayBuilder& CountOperation(Token::Value op, int feedback_slot); | 298 BytecodeArrayBuilder& CountOperation(Token::Value op, int feedback_slot); |
| 299 | 299 |
| 300 enum class ToBooleanMode { |
| 301 kConvertToBoolean, // Perform ToBoolean conversion on accumulator. |
| 302 kAlreadyBoolean, // Accumulator is already a Boolean. |
| 303 }; |
| 304 |
| 300 // Unary Operators. | 305 // Unary Operators. |
| 301 BytecodeArrayBuilder& LogicalNot(); | 306 BytecodeArrayBuilder& LogicalNot(ToBooleanMode mode); |
| 302 BytecodeArrayBuilder& TypeOf(); | 307 BytecodeArrayBuilder& TypeOf(); |
| 303 | 308 |
| 304 // Expects a heap object in the accumulator. Returns its super constructor in | 309 // Expects a heap object in the accumulator. Returns its super constructor in |
| 305 // the register |out| if it passes the IsConstructor test. Otherwise, it | 310 // the register |out| if it passes the IsConstructor test. Otherwise, it |
| 306 // throws a TypeError exception. | 311 // throws a TypeError exception. |
| 307 BytecodeArrayBuilder& GetSuperConstructor(Register out); | 312 BytecodeArrayBuilder& GetSuperConstructor(Register out); |
| 308 | 313 |
| 309 // Deletes property from an object. This expects that accumulator contains | 314 // Deletes property from an object. This expects that accumulator contains |
| 310 // the key to be deleted and the register contains a reference to the object. | 315 // the key to be deleted and the register contains a reference to the object. |
| 311 BytecodeArrayBuilder& Delete(Register object, LanguageMode language_mode); | 316 BytecodeArrayBuilder& Delete(Register object, LanguageMode language_mode); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 324 // Converts accumulator and stores result in register |out|. | 329 // Converts accumulator and stores result in register |out|. |
| 325 BytecodeArrayBuilder& ConvertAccumulatorToObject(Register out); | 330 BytecodeArrayBuilder& ConvertAccumulatorToObject(Register out); |
| 326 BytecodeArrayBuilder& ConvertAccumulatorToName(Register out); | 331 BytecodeArrayBuilder& ConvertAccumulatorToName(Register out); |
| 327 BytecodeArrayBuilder& ConvertAccumulatorToNumber(Register out); | 332 BytecodeArrayBuilder& ConvertAccumulatorToNumber(Register out); |
| 328 | 333 |
| 329 // Flow Control. | 334 // Flow Control. |
| 330 BytecodeArrayBuilder& Bind(BytecodeLabel* label); | 335 BytecodeArrayBuilder& Bind(BytecodeLabel* label); |
| 331 BytecodeArrayBuilder& Bind(const BytecodeLabel& target, BytecodeLabel* label); | 336 BytecodeArrayBuilder& Bind(const BytecodeLabel& target, BytecodeLabel* label); |
| 332 | 337 |
| 333 BytecodeArrayBuilder& Jump(BytecodeLabel* label); | 338 BytecodeArrayBuilder& Jump(BytecodeLabel* label); |
| 334 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label); | 339 BytecodeArrayBuilder& JumpLoop(BytecodeLabel* label, int loop_depth); |
| 335 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label); | 340 |
| 341 BytecodeArrayBuilder& JumpIfTrue(ToBooleanMode mode, BytecodeLabel* label); |
| 342 BytecodeArrayBuilder& JumpIfFalse(ToBooleanMode mode, BytecodeLabel* label); |
| 336 BytecodeArrayBuilder& JumpIfNotHole(BytecodeLabel* label); | 343 BytecodeArrayBuilder& JumpIfNotHole(BytecodeLabel* label); |
| 337 BytecodeArrayBuilder& JumpIfJSReceiver(BytecodeLabel* label); | 344 BytecodeArrayBuilder& JumpIfJSReceiver(BytecodeLabel* label); |
| 338 BytecodeArrayBuilder& JumpIfNull(BytecodeLabel* label); | 345 BytecodeArrayBuilder& JumpIfNull(BytecodeLabel* label); |
| 339 BytecodeArrayBuilder& JumpIfNotNull(BytecodeLabel* label); | 346 BytecodeArrayBuilder& JumpIfNotNull(BytecodeLabel* label); |
| 340 BytecodeArrayBuilder& JumpIfUndefined(BytecodeLabel* label); | 347 BytecodeArrayBuilder& JumpIfUndefined(BytecodeLabel* label); |
| 341 BytecodeArrayBuilder& JumpIfNotUndefined(BytecodeLabel* label); | 348 BytecodeArrayBuilder& JumpIfNotUndefined(BytecodeLabel* label); |
| 342 BytecodeArrayBuilder& JumpIfNil(BytecodeLabel* label, Token::Value op, | 349 BytecodeArrayBuilder& JumpIfNil(BytecodeLabel* label, Token::Value op, |
| 343 NilValue nil); | 350 NilValue nil); |
| 344 BytecodeArrayBuilder& JumpIfNotNil(BytecodeLabel* label, Token::Value op, | 351 BytecodeArrayBuilder& JumpIfNotNil(BytecodeLabel* label, Token::Value op, |
| 345 NilValue nil); | 352 NilValue nil); |
| 346 BytecodeArrayBuilder& JumpLoop(BytecodeLabel* label, int loop_depth); | |
| 347 | 353 |
| 348 BytecodeArrayBuilder& StackCheck(int position); | 354 BytecodeArrayBuilder& StackCheck(int position); |
| 349 | 355 |
| 350 // Sets the pending message to the value in the accumulator, and returns the | 356 // Sets the pending message to the value in the accumulator, and returns the |
| 351 // previous pending message in the accumulator. | 357 // previous pending message in the accumulator. |
| 352 BytecodeArrayBuilder& SetPendingMessage(); | 358 BytecodeArrayBuilder& SetPendingMessage(); |
| 353 | 359 |
| 354 BytecodeArrayBuilder& Throw(); | 360 BytecodeArrayBuilder& Throw(); |
| 355 BytecodeArrayBuilder& ReThrow(); | 361 BytecodeArrayBuilder& ReThrow(); |
| 356 BytecodeArrayBuilder& Return(); | 362 BytecodeArrayBuilder& Return(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 BytecodeArrayWriter bytecode_array_writer_; | 504 BytecodeArrayWriter bytecode_array_writer_; |
| 499 BytecodePipelineStage* pipeline_; | 505 BytecodePipelineStage* pipeline_; |
| 500 BytecodeRegisterOptimizer* register_optimizer_; | 506 BytecodeRegisterOptimizer* register_optimizer_; |
| 501 BytecodeSourceInfo latest_source_info_; | 507 BytecodeSourceInfo latest_source_info_; |
| 502 | 508 |
| 503 static int const kNoFeedbackSlot = 0; | 509 static int const kNoFeedbackSlot = 0; |
| 504 | 510 |
| 505 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); | 511 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); |
| 506 }; | 512 }; |
| 507 | 513 |
| 514 V8_EXPORT_PRIVATE std::ostream& operator<<( |
| 515 std::ostream& os, const BytecodeArrayBuilder::ToBooleanMode& mode); |
| 516 |
| 508 } // namespace interpreter | 517 } // namespace interpreter |
| 509 } // namespace internal | 518 } // namespace internal |
| 510 } // namespace v8 | 519 } // namespace v8 |
| 511 | 520 |
| 512 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 521 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| OLD | NEW |