| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/arm64/lithium-codegen-arm64.h" | 7 #include "src/arm64/lithium-codegen-arm64.h" |
| 8 #include "src/arm64/lithium-gap-resolver-arm64.h" | 8 #include "src/arm64/lithium-gap-resolver-arm64.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 void LCodeGen::WriteTranslation(LEnvironment* environment, | 221 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| 222 Translation* translation) { | 222 Translation* translation) { |
| 223 if (environment == NULL) return; | 223 if (environment == NULL) return; |
| 224 | 224 |
| 225 // The translation includes one command per value in the environment. | 225 // The translation includes one command per value in the environment. |
| 226 int translation_size = environment->translation_size(); | 226 int translation_size = environment->translation_size(); |
| 227 // The output frame height does not include the parameters. | 227 // The output frame height does not include the parameters. |
| 228 int height = translation_size - environment->parameter_count(); | 228 int height = translation_size - environment->parameter_count(); |
| 229 | 229 |
| 230 WriteTranslation(environment->outer(), translation); | 230 WriteTranslation(environment->outer(), translation); |
| 231 bool has_closure_id = !info()->closure().is_null() && | |
| 232 !info()->closure().is_identical_to(environment->closure()); | |
| 233 int closure_id = has_closure_id | |
| 234 ? DefineDeoptimizationLiteral(environment->closure()) | |
| 235 : Translation::kSelfLiteralId; | |
| 236 | 231 |
| 237 switch (environment->frame_type()) { | 232 switch (environment->frame_type()) { |
| 238 case JS_FUNCTION: | 233 case JS_FUNCTION: { |
| 239 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | 234 int shared_id = DefineDeoptimizationLiteral( |
| 235 environment->entry() ? environment->entry()->shared() |
| 236 : info()->shared_info()); |
| 237 translation->BeginJSFrame(environment->ast_id(), shared_id, height); |
| 238 if (info()->closure().is_identical_to(environment->closure())) { |
| 239 translation->StoreJSFrameFunction(); |
| 240 } else { |
| 241 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 242 translation->StoreLiteral(closure_id); |
| 243 } |
| 240 break; | 244 break; |
| 241 case JS_CONSTRUCT: | 245 } |
| 242 translation->BeginConstructStubFrame(closure_id, translation_size); | 246 case JS_CONSTRUCT: { |
| 247 int shared_id = DefineDeoptimizationLiteral( |
| 248 environment->entry() ? environment->entry()->shared() |
| 249 : info()->shared_info()); |
| 250 translation->BeginConstructStubFrame(shared_id, translation_size); |
| 251 if (info()->closure().is_identical_to(environment->closure())) { |
| 252 translation->StoreJSFrameFunction(); |
| 253 } else { |
| 254 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 255 translation->StoreLiteral(closure_id); |
| 256 } |
| 243 break; | 257 break; |
| 244 case JS_GETTER: | 258 } |
| 259 case JS_GETTER: { |
| 245 DCHECK(translation_size == 1); | 260 DCHECK(translation_size == 1); |
| 246 DCHECK(height == 0); | 261 DCHECK(height == 0); |
| 247 translation->BeginGetterStubFrame(closure_id); | 262 int shared_id = DefineDeoptimizationLiteral( |
| 263 environment->entry() ? environment->entry()->shared() |
| 264 : info()->shared_info()); |
| 265 translation->BeginGetterStubFrame(shared_id); |
| 266 if (info()->closure().is_identical_to(environment->closure())) { |
| 267 translation->StoreJSFrameFunction(); |
| 268 } else { |
| 269 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 270 translation->StoreLiteral(closure_id); |
| 271 } |
| 248 break; | 272 break; |
| 249 case JS_SETTER: | 273 } |
| 274 case JS_SETTER: { |
| 250 DCHECK(translation_size == 2); | 275 DCHECK(translation_size == 2); |
| 251 DCHECK(height == 0); | 276 DCHECK(height == 0); |
| 252 translation->BeginSetterStubFrame(closure_id); | 277 int shared_id = DefineDeoptimizationLiteral( |
| 278 environment->entry() ? environment->entry()->shared() |
| 279 : info()->shared_info()); |
| 280 translation->BeginSetterStubFrame(shared_id); |
| 281 if (info()->closure().is_identical_to(environment->closure())) { |
| 282 translation->StoreJSFrameFunction(); |
| 283 } else { |
| 284 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 285 translation->StoreLiteral(closure_id); |
| 286 } |
| 253 break; | 287 break; |
| 288 } |
| 289 case ARGUMENTS_ADAPTOR: { |
| 290 int shared_id = DefineDeoptimizationLiteral( |
| 291 environment->entry() ? environment->entry()->shared() |
| 292 : info()->shared_info()); |
| 293 translation->BeginArgumentsAdaptorFrame(shared_id, translation_size); |
| 294 if (info()->closure().is_identical_to(environment->closure())) { |
| 295 translation->StoreJSFrameFunction(); |
| 296 } else { |
| 297 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 298 translation->StoreLiteral(closure_id); |
| 299 } |
| 300 break; |
| 301 } |
| 254 case STUB: | 302 case STUB: |
| 255 translation->BeginCompiledStubFrame(translation_size); | 303 translation->BeginCompiledStubFrame(translation_size); |
| 256 break; | 304 break; |
| 257 case ARGUMENTS_ADAPTOR: | |
| 258 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | |
| 259 break; | |
| 260 default: | |
| 261 UNREACHABLE(); | |
| 262 } | 305 } |
| 263 | 306 |
| 264 int object_index = 0; | 307 int object_index = 0; |
| 265 int dematerialized_index = 0; | 308 int dematerialized_index = 0; |
| 266 for (int i = 0; i < translation_size; ++i) { | 309 for (int i = 0; i < translation_size; ++i) { |
| 267 LOperand* value = environment->values()->at(i); | 310 LOperand* value = environment->values()->at(i); |
| 268 | 311 AddToTranslation( |
| 269 AddToTranslation(environment, | 312 environment, translation, value, environment->HasTaggedValueAt(i), |
| 270 translation, | 313 environment->HasUint32ValueAt(i), &object_index, &dematerialized_index); |
| 271 value, | |
| 272 environment->HasTaggedValueAt(i), | |
| 273 environment->HasUint32ValueAt(i), | |
| 274 &object_index, | |
| 275 &dematerialized_index); | |
| 276 } | 314 } |
| 277 } | 315 } |
| 278 | 316 |
| 279 | 317 |
| 280 void LCodeGen::AddToTranslation(LEnvironment* environment, | 318 void LCodeGen::AddToTranslation(LEnvironment* environment, |
| 281 Translation* translation, | 319 Translation* translation, |
| 282 LOperand* op, | 320 LOperand* op, |
| 283 bool is_tagged, | 321 bool is_tagged, |
| 284 bool is_uint32, | 322 bool is_uint32, |
| 285 int* object_index_pointer, | 323 int* object_index_pointer, |
| (...skipping 5809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6095 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6133 Handle<ScopeInfo> scope_info = instr->scope_info(); |
| 6096 __ Push(scope_info); | 6134 __ Push(scope_info); |
| 6097 __ Push(ToRegister(instr->function())); | 6135 __ Push(ToRegister(instr->function())); |
| 6098 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6136 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6099 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6137 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6100 } | 6138 } |
| 6101 | 6139 |
| 6102 | 6140 |
| 6103 } // namespace internal | 6141 } // namespace internal |
| 6104 } // namespace v8 | 6142 } // namespace v8 |
| OLD | NEW |